· 6 years ago · Oct 13, 2019, 04:14 PM
1import chalk from 'chalk';
2
3const menus = {
4 main: `
5${chalk.greenBright('weather [command] <options>')}
6
7 ${chalk.blueBright('now')} ................ show weather for now
8 ${chalk.blueBright('forecast')} ........... show weather forecast
9 ${chalk.blueBright('config')}.............. set API key, default city ID, default temperature units
10 ${chalk.blueBright('version')} ............ show package version
11 ${chalk.blueBright('help')} ............... show help menu for a command
12`,
13
14 now: `//...
15 `,
16 forecast: `//...
17 `,
18 config: `//...
19 `,
20}
21
22export async function help(args) {
23 const subCmd = args._[0] === 'help'
24 ? args._[1]
25 : args._[0]
26 console.log(menus[subCmd] || menus.main)
27}