snakcmd
v2.0.1
Published
An easy to use command line builder
Downloads
5
Readme
SnakCMD
Installation
npm install snakcmd
Usage
import SnakCMD from "snakcmd";
new SnakCMD()
.command(['get', 'g'], (value, argMap) => {
if (argMap.has('put'))
console.log('Put Stuff!')
console.log(`Get => ${value}`);
})
.command(['put'], value => {
console.log(`Put => ${value}`);
})
.option('-m', value => {
console.log(`Message -> ${value}`);
})
.option(['-a', '--add'], value => {
console.log(`Add -> ${value}`)
})
.run(process.argv.slice(2), argvMap => {
return 0;
});
$ cmd get fish -a -m "its cooked"
Get => fish
-a => null
-m => its cooked
$ cmd get goose put cats
Put stuff!
Get => fish
Put => cats
$ cmd -am "some message"
-a => null
-m => "some message"