반응형

개요

yargs 에서 임의로 help를 출력해주고 싶을 때 사용한다

코드

const yargs = require('yargs');

const argv = yargs
    .command('lyr', 'Tells whether an year is leap year or not', {
        year: {
            description: 'the year to check for',
            alias: 'y',
            type: 'number',
        }
    })
    .option('time', {
        alias: 't',
        description: 'Tell the present Time',
        type: 'boolean',
    })
    .help()
    .alias('help', 'h')
    .argv;
    
yargs.showHelp();
반응형

'javascript' 카테고리의 다른 글

[puppeteer] No usable sandbox  (0) 2020.02.21
[javascript] if number 조건일 때 주의  (0) 2020.01.09
[javascript] array - includes()  (0) 2019.12.09

+ Recent posts