Swapped tslint to eslint and fixed files

This commit is contained in:
Arwid Thornström
2023-02-03 12:48:29 +01:00
committed by GitHub
parent 258e0b2dde
commit a7da247cf4
15 changed files with 1136 additions and 386 deletions
+35 -24
View File
@@ -5,14 +5,14 @@ import { defaultMenuSettings, getSettings } from '../../../globals';
const { Confirm, Input } = require('enquirer');
const checkCLIProgram = async (toolbox: GluegunMenuToolbox, cmd: string) => {
const {print, system, strings} = toolbox;
const { print, system, strings } = toolbox;
try {
const result = strings.trim(await system.run(`command -v ${cmd}`));
return true;
} catch(e) {
} catch (e) {
return false;
}
}
};
module.exports = {
name: 'settings',
@@ -20,10 +20,10 @@ module.exports = {
description: 'Setup settings for pwcli (se)',
hidden: false,
run: async (toolbox: GluegunMenuToolbox) => {
const { print, system, strings } = toolbox;
const {print, system, strings} = toolbox;
print.info(chalk.yellow(`
print.info(
chalk.yellow(`
This will help you setup everything needed to run pwcli on a mac (maby linux).
All settings will be saved to ${chalk.cyan('~/.pwcli_settings')}
@@ -31,7 +31,8 @@ module.exports = {
First step is to install aws cli [https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html]
and configuring it. Install it either with brew or do as specified in the link.
`));
`)
);
let config = await getSettings(toolbox);
@@ -40,7 +41,7 @@ module.exports = {
// print.info(`\nDetected ${chalk.green('brew')}`);
// } else {
// print.info(`\nRequired program ${chalk.green('brew')} is not installed.`);
// if (await (new Confirm({
// name: 'confirm',
// message: `Do you want pwcli to install it?`
@@ -93,7 +94,7 @@ module.exports = {
// name: 'confirm',
// message: `Is ${chalk.green('aws cli')} installed and configured?`
// })).run()) {
// } else {
// print.info('😔 ok, install it and run ..');
// await toolbox.menu.showMenu();
@@ -101,38 +102,48 @@ module.exports = {
// }
await system.run('touch ~/.pwcli_settings');
print.info(`Created configuration file ${chalk.yellow(`~/.pwcli_settings`)}`);
print.info(
`Created configuration file ${chalk.yellow(`~/.pwcli_settings`)}`
);
if (!config) {
config = {
gh_token: '',
photowall_repo: '',
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 >`,
initial: config.gh_token,
})).run();
config.photowall_repo = await (new Input({
config.gh_token = await new Input({
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 use current branch in your photowall repository\nor the create and update commands for testservers, please insert\nthe absolute path to the project or leave blank >`,
initial: config.photowall_repo,
})).run();
initial: config.photowall_repo
}).run();
print.info(`
${JSON.stringify(config)}
`);
if (await (new Confirm({
message: `Ok to save the these settings to ${chalk.yellow(`~/.pwcli_settings`)}?`
})).run()) {
if (
await new Confirm({
message: `Ok to save the these settings to ${chalk.yellow(
`~/.pwcli_settings`
)}?`
}).run()
) {
await system.run(`echo '${JSON.stringify(config)}' > ~/.pwcli_settings`);
} else {
print.info('Ok then.');
if (toolbox.fromMenu()) await toolbox.menu.showMenu(null, defaultMenuSettings);
if (toolbox.fromMenu())
await toolbox.menu.showMenu(null, defaultMenuSettings);
}
if (toolbox.fromMenu()) await toolbox.menu.showMenu(null, defaultMenuSettings);
if (toolbox.fromMenu())
await toolbox.menu.showMenu(null, defaultMenuSettings);
}
};