Skip to content

Instantly share code, notes, and snippets.

@RubaXa
Created May 30, 2021 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RubaXa/80c3f6aeffa6743e06f53600ca5946c7 to your computer and use it in GitHub Desktop.
Save RubaXa/80c3f6aeffa6743e06f53600ca5946c7 to your computer and use it in GitHub Desktop.
CLI: Тестовая команда
import {createCommand} from '@mail-core/cli';
export const test = createCommand({
name: 'test',
describe: 'Тестовая команда',
options: {
val: {
desc: 'Any value',
type: 'string',
default: 'Wow!',
},
},
async handler(argv, {console, describe, options, style}) {
// Print command description
console.important(describe);
// Prompt user for option or use default
const value = await console.cli.require(options.val);
// Print 'value' with style and color
console.log('value:', style.bold.cyan(value), style.gray(argv.val));
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment