added support for current branch, and some cleanup

This commit is contained in:
Arwid Thornström
2022-01-21 15:23:19 +01:00
parent fda1b42e9f
commit c00be4305e
5 changed files with 78 additions and 38 deletions
@@ -3,7 +3,7 @@ const chalk = require('chalk');
const { Input, Confirm } = require('enquirer');
import { Octokit } from "@octokit/core";
import { GluegunPrint } from 'gluegun';
import { defaultMenuSettings } from '../../../../globals';
import { defaultMenuSettings, getSettings } from '../../../../globals';
const os = require("os");
const STACK_DEFAULTS = {
@@ -119,20 +119,12 @@ module.exports = {
const { system, strings, print, filesystem } = toolbox;
// Load settings
const config = await filesystem.readAsync(`${os.homedir()}/.pwcli_settings`, "json");
const config = await getSettings(toolbox);
if (!config) {
print.error(`
No config found, please run [ ${chalk.cyan('pwcli s')} ] or setup from the menu.
`);
if (toolbox.fromMenu()) {
await toolbox.menu.showMenu(null, defaultMenuSettings)
} else {
return;
}
await toolbox.menu.showMenu('setup', defaultMenuSettings);
return;
}
let branchName = null;
while (!branchName) {
branchName = await getBranchName(print, config.gh_token);
@@ -238,11 +230,11 @@ module.exports = {
print.fancy(await system.run(createCommand, {cwd: '/tmp/', trim: true}));
}
} catch (e) {
console.log(`e`, e)
console.log(`e`, e);
}
if (toolbox.fromMenu()) {
await toolbox.menu.showMenu('deployment testservers', defaultMenuSettings)
await toolbox.menu.showMenu('deployment testservers', defaultMenuSettings);
}
}
}