0.0.2 • Published 6 years ago
console-autocompletion v0.0.2
Console Autocompletion
This is a sub project for c++ flag parser console. But it can be used for general purpose.
How to use
- Install the package.
npm install -g console-autocompletion- Prepare json file describing your flgas.
[
{
"shortName": "-n1",
"longName": "--number1",
"needsValue": true
},
{
"shortName": "-n2",
"longName": "--number2",
"needsValue": true
}
]- Copy to
~/.console-autocompletion/.
cp /path/to/json ~/.console-autocompletion/- Generate
bash_completionand activate it.
console-autocompletion-installer program_name /path/to/bash_completion
source /path/to/bash_completionFlag
name: name of the flag, ifnameis set,shortNameorlongNameshould not be set. At this locaiton, value should be come. It means it's a positional flag.shortName: '-' prefixed name, ifshortNameis set,nameshould not be set. It means it's an optional flag.longName: '--' prefixed name, iflongNameis set,nameshould not be set. It means it's an optional flag.needsValue: If it is set to true, this optional flag should be followed by value.isSequential: If it is set to true, this optional flag can be come multiple times.subFlags: If it is set, after this positional flag, the subarray will be parsed.