cli-training
Version:
get to know amir with `npx amir`
63 lines (52 loc) • 1.36 kB
JavaScript
import chalk from 'chalk';
import meow from 'meow';
const helpText = `
Usage:
${chalk.green('npx amir')} ${chalk.yellow('[--options]')} ${chalk.cyan('<command>')}
Options:
${chalk.yellow('--social')} print the social info
${chalk.yellow('--bio')} print the bio info
${chalk.yellow('--no-social')} don't print the social info
${chalk.yellow('--ad')} print the ad info
${chalk.yellow('--no-ad')} don't print the ad info
${chalk.yellow('-d , --debug')} print the debug info
${chalk.yellow('-v,--version')} print cli version
Commands:
${chalk.cyan('help')} ${chalk.green('print cli help')}
Examples:
${chalk.green('npx amir')} ${chalk.green('--no-social')}
${chalk.green('npx amir')} ${chalk.green('--no-ad')}
`;
const option = {
importMeta: import.meta,
hardRejection: false,
// inferType: true,
flags: {
social: {
type: 'boolean',
default: true
},
bio: {
type: 'boolean',
default: true
},
ad: {
type: 'boolean',
default: true
},
debug: {
type: 'boolean',
default: false,
shortFlag: 'd'
},
version: {
type: 'boolean',
default: false,
shortFlag: 'v'
}
}
};
const cli = meow(helpText, option);
export default cli;
// green : executables
// yellow : options