help
This commit is contained in:
+8
-6
@@ -15,21 +15,23 @@ async function run(argv) {
|
|||||||
})
|
})
|
||||||
.help({
|
.help({
|
||||||
name: 'help',
|
name: 'help',
|
||||||
alias: 'helpmeplease',
|
alias: 'h',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
dashed: true,
|
dashed: true,
|
||||||
run: toolbox => toolbox.print.info('No help for you!')
|
run: toolbox => {
|
||||||
|
toolbox.print.info('This is the help');
|
||||||
|
}
|
||||||
}) // provides default for help, h, --help, -h
|
}) // provides default for help, h, --help, -h
|
||||||
.version() // provides default for version, v, --version, -v
|
// .version() // provides default for version, v, --version, -v
|
||||||
.create()
|
.create()
|
||||||
// enable the following method if you'd like to skip loading one of these core extensions
|
// enable the following method if you'd like to skip loading one of these core extensions
|
||||||
// this can improve performance if they're not necessary for your project:
|
// this can improve performance if they're not necessary for your project:
|
||||||
// .exclude(['meta', 'strings', 'print', 'filesystem', 'semver', 'system', 'prompt', 'http', 'template', 'patching', 'package-manager'])
|
// .exclude(['meta', 'strings', 'print', 'filesystem', 'semver', 'system', 'prompt', 'http', 'template', 'patching', 'package-manager'])
|
||||||
// and run it
|
// and run it
|
||||||
const toolbox = await cli.run(argv)
|
const toolbox = await cli.run(argv);
|
||||||
|
|
||||||
// send it back (for testing, mostly)
|
// send it back (for testing, mostly)
|
||||||
return toolbox
|
return toolbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { run }
|
module.exports = { run }
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
||||||
|
import { defaultMenuSettings } from '../../globals';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'deployment',
|
name: 'deployment',
|
||||||
alias: ['d'],
|
alias: ['d'],
|
||||||
description: 'Description for deployment (d)',
|
description: 'Deployment (d)',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
await toolbox.menu.showMenu('deployment');
|
await toolbox.menu.showMenu('deployment', defaultMenuSettings);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const chalk = require('chalk');
|
|||||||
const { Input, Confirm } = require('enquirer');
|
const { Input, Confirm } = require('enquirer');
|
||||||
import { Octokit } from "@octokit/core";
|
import { Octokit } from "@octokit/core";
|
||||||
import { GluegunPrint } from 'gluegun';
|
import { GluegunPrint } from 'gluegun';
|
||||||
|
import { defaultMenuSettings } from '../../../../globals';
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
|
|
||||||
const STACK_DEFAULTS = {
|
const STACK_DEFAULTS = {
|
||||||
@@ -113,7 +114,7 @@ module.exports = {
|
|||||||
name: 'create',
|
name: 'create',
|
||||||
alias: ['c'],
|
alias: ['c'],
|
||||||
description: 'Create new testserver on aws (c)',
|
description: 'Create new testserver on aws (c)',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
const { system, strings, print, filesystem } = toolbox;
|
const { system, strings, print, filesystem } = toolbox;
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ module.exports = {
|
|||||||
|
|
||||||
`);
|
`);
|
||||||
if (toolbox.fromMenu()) {
|
if (toolbox.fromMenu()) {
|
||||||
await toolbox.menu.showMenu()
|
await toolbox.menu.showMenu(null, defaultMenuSettings)
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -204,7 +205,7 @@ module.exports = {
|
|||||||
|
|
||||||
`);
|
`);
|
||||||
if (toolbox.fromMenu()) {
|
if (toolbox.fromMenu()) {
|
||||||
await toolbox.menu.showMenu('deployment testservers');
|
await toolbox.menu.showMenu('deployment testservers', defaultMenuSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +242,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toolbox.fromMenu()) {
|
if (toolbox.fromMenu()) {
|
||||||
await toolbox.menu.showMenu('deployment testservers')
|
await toolbox.menu.showMenu('deployment testservers', defaultMenuSettings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu'
|
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu'
|
||||||
import { GluegunSystem, print } from 'gluegun';
|
import { GluegunSystem, print } from 'gluegun';
|
||||||
|
import { defaultMenuSettings } from '../../../../globals';
|
||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
const { AutoComplete, Input, Confirm } = require('enquirer');
|
const { AutoComplete, Input, Confirm } = require('enquirer');
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ module.exports = {
|
|||||||
name: 'delete',
|
name: 'delete',
|
||||||
alias: ['d'],
|
alias: ['d'],
|
||||||
description: 'Choose a testserver to delete (d)',
|
description: 'Choose a testserver to delete (d)',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
|
|
||||||
const { system, strings, print } = toolbox;
|
const { system, strings, print } = toolbox;
|
||||||
@@ -127,7 +128,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toolbox.fromMenu()) {
|
if (toolbox.fromMenu()) {
|
||||||
await toolbox.menu.showMenu('deployment testservers');
|
await toolbox.menu.showMenu('deployment testservers', defaultMenuSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu'
|
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu'
|
||||||
|
import { defaultMenuSettings } from '../../../../globals';
|
||||||
const tto = require('terminal-table-output').create();
|
const tto = require('terminal-table-output').create();
|
||||||
|
|
||||||
type Stack = {
|
type Stack = {
|
||||||
@@ -13,7 +14,7 @@ module.exports = {
|
|||||||
name: 'status',
|
name: 'status',
|
||||||
alias: ['s'],
|
alias: ['s'],
|
||||||
description: 'Show status for available testservers (s)',
|
description: 'Show status for available testservers (s)',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
|
|
||||||
const { system, strings } = toolbox
|
const { system, strings } = toolbox
|
||||||
@@ -62,7 +63,7 @@ module.exports = {
|
|||||||
tto.print(true);
|
tto.print(true);
|
||||||
|
|
||||||
if (toolbox.fromMenu()) {
|
if (toolbox.fromMenu()) {
|
||||||
await toolbox.menu.showMenu('deployment testservers');
|
await toolbox.menu.showMenu('deployment testservers', defaultMenuSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
||||||
|
import { defaultMenuSettings } from '../../../globals';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section1 menu
|
* Section1 menu
|
||||||
@@ -7,8 +8,8 @@ module.exports = {
|
|||||||
name: 'testservers',
|
name: 'testservers',
|
||||||
alias: ['ts'],
|
alias: ['ts'],
|
||||||
description: 'Deploy to testservers (ts)',
|
description: 'Deploy to testservers (ts)',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
await toolbox.menu.showMenu('deployment testservers');
|
await toolbox.menu.showMenu('deployment testservers', defaultMenuSettings);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const chalk = require('chalk');
|
|||||||
const { AutoComplete, Input, Confirm } = require('enquirer');
|
const { AutoComplete, Input, Confirm } = require('enquirer');
|
||||||
import { Octokit } from "@octokit/core";
|
import { Octokit } from "@octokit/core";
|
||||||
import { GluegunPrint } from 'gluegun';
|
import { GluegunPrint } from 'gluegun';
|
||||||
|
import { defaultMenuSettings } from '../../../../globals';
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
|
|
||||||
const STACK_DEFAULTS = {
|
const STACK_DEFAULTS = {
|
||||||
@@ -111,7 +112,7 @@ module.exports = {
|
|||||||
name: 'update',
|
name: 'update',
|
||||||
alias: ['u'],
|
alias: ['u'],
|
||||||
description: 'Update stack with different branch (u)',
|
description: 'Update stack with different branch (u)',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
const { system, strings, print, filesystem } = toolbox;
|
const { system, strings, print, filesystem } = toolbox;
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ module.exports = {
|
|||||||
|
|
||||||
`);
|
`);
|
||||||
if (toolbox.fromMenu()) {
|
if (toolbox.fromMenu()) {
|
||||||
await toolbox.menu.showMenu()
|
await toolbox.menu.showMenu(null, defaultMenuSettings)
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -212,7 +213,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toolbox.fromMenu()) {
|
if (toolbox.fromMenu()) {
|
||||||
await toolbox.menu.showMenu('deployment testservers')
|
await toolbox.menu.showMenu('deployment testservers', defaultMenuSettings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
||||||
import { GluegunCommand } from 'gluegun'
|
import { GluegunCommand } from 'gluegun'
|
||||||
|
|
||||||
|
|
||||||
const command: GluegunCommand = {
|
const command: GluegunCommand = {
|
||||||
name: 'pwcli',
|
name: 'pwcli',
|
||||||
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
const { print } = toolbox;
|
const { print } = toolbox;
|
||||||
print.info('Welcome to photowall CLI for everything, almost 😬');
|
print.info('Welcome to photowall CLI for everything, almost 😬');
|
||||||
await toolbox.menu.showMenu();
|
await toolbox.menu.showMenu(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
||||||
import chalk = require('chalk');
|
import chalk = require('chalk');
|
||||||
import { system } from 'gluegun';
|
import { system } from 'gluegun';
|
||||||
|
import { defaultMenuSettings } from '../../../globals';
|
||||||
const { Confirm, Input } = require('enquirer');
|
const { Confirm, Input } = require('enquirer');
|
||||||
|
|
||||||
const checkCLIProgram = async (toolbox: GluegunMenuToolbox, cmd: string) => {
|
const checkCLIProgram = async (toolbox: GluegunMenuToolbox, cmd: string) => {
|
||||||
@@ -17,7 +18,7 @@ module.exports = {
|
|||||||
name: 'settings',
|
name: 'settings',
|
||||||
alias: ['se'],
|
alias: ['se'],
|
||||||
description: 'Setup settings for pwcli (se)',
|
description: 'Setup settings for pwcli (se)',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
|
|
||||||
const {print, system, strings} = toolbox;
|
const {print, system, strings} = toolbox;
|
||||||
@@ -123,9 +124,9 @@ module.exports = {
|
|||||||
await system.run(`echo '${JSON.stringify(config)}' > ~/.pwcli_settings`);
|
await system.run(`echo '${JSON.stringify(config)}' > ~/.pwcli_settings`);
|
||||||
} else {
|
} else {
|
||||||
print.info('Ok then.');
|
print.info('Ok then.');
|
||||||
if (toolbox.fromMenu()) await toolbox.menu.showMenu();
|
if (toolbox.fromMenu()) await toolbox.menu.showMenu(null, defaultMenuSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toolbox.fromMenu()) await toolbox.menu.showMenu();
|
if (toolbox.fromMenu()) await toolbox.menu.showMenu(null, defaultMenuSettings);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
import { GluegunMenuToolbox } from '@lenne.tech/gluegun-menu';
|
||||||
|
import { defaultMenuSettings } from '../../globals';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section1 menu
|
* Section1 menu
|
||||||
@@ -7,8 +8,8 @@ module.exports = {
|
|||||||
name: 'setup',
|
name: 'setup',
|
||||||
alias: ['s'],
|
alias: ['s'],
|
||||||
description: 'Setup pwcli (s)',
|
description: 'Setup pwcli (s)',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
await toolbox.menu.showMenu('setup');
|
await toolbox.menu.showMenu('setup', defaultMenuSettings);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
export const defaultMenuSettings = {
|
||||||
|
showHelp: false
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user