Skip to content

Command line boilerplate for zero effort and easy cli support

License

Notifications You must be signed in to change notification settings

360fy/command-line-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

command-line-boilerplate

Example

import globalOption from 'command-line-boilerplate/lib/GlobalOption';
import globalArg from 'command-line-boilerplate/lib/GlobalArg';
import runCli from 'command-line-boilerplate/lib/CliRunner';
import outputHelp from 'command-line-boilerplate/lib/OutputHelp';

// more such global options can be defined
globalOption('-c, --config [CONFIG]', 'Path to JSON / YAML based environment configs, such as esConfig, redisConfig etc');

// runs the cli
runCli(true);

// extract command line args
const config = globalArg('config');
if (!config) {
    console.error('No config was specified');

    // output formatted cli help
    outputHelp();

    return false;
}

// do other tasks

More examples link

About

Command line boilerplate for zero effort and easy cli support

Resources

License

Stars

Watchers

Forks

Packages

No packages published