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
+13 -7
View File
@@ -1,7 +1,7 @@
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
import chalk = require('chalk');
import { system } from 'gluegun';
import { defaultMenuSettings } from '../../../globals';
import { defaultMenuSettings, getSettings } from '../../../globals';
const { Confirm, Input } = require('enquirer');
const checkCLIProgram = async (toolbox: GluegunMenuToolbox, cmd: string) => {
@@ -33,6 +33,8 @@ module.exports = {
`));
let config = await getSettings(toolbox);
// Check if brew is installed
// if (await checkCLIProgram(toolbox, 'brew')) {
// print.info(`\nDetected ${chalk.green('brew')}`);
@@ -100,17 +102,21 @@ module.exports = {
await system.run('touch ~/.pwcli_settings');
print.info(`Created configuration file ${chalk.yellow(`~/.pwcli_settings`)}`);
const config = {
gh_token: '',
photowall_repo: '',
};
if (!config) {
config = {
gh_token: '',
photowall_repo: '',
};
}
config.gh_token = await (new Input({
message: `A github accesstoken is required with ${chalk.yellow('Full control of private repositories')}, please insert the key >`
message: `A github accesstoken is required with ${chalk.yellow('Full control of private repositories')}, please insert the key >`,
initial: config.gh_token,
})).run();
config.photowall_repo = await (new Input({
message: `If you want to be able to push active branch in your photowall repository, please insert the absolute path to the project >`
message: `If you want to be able to use current branch in your photowall repository\nwhen creating or updating testservers, please insert\nthe absolute path to the project or leave blank >`,
initial: config.photowall_repo,
})).run();
print.info(`