shargs-example-repl is a sample application of shargs 🦈.
See the shargs
github repository for more details!
$ git clone https://github.com/Yord/shargs-example-repl.git
$ cd shargs-example-repl
$ npm i
$ chmod +x ./repl
This repository is a simple example of a program using the shargs command-line parser.
The program can be found in the repl
script.
Start the repl with:
$ ./repl
If you type help
, the following output is shown:
help Print usage documentation.
echo Echos a string.
<text> This text is echoed.
case Transforms its argument into upper or lower case
depending on the --mode.
<text> This text is transformed into upper or lower case.
--mode=<upper|lower> How to transform the text.
If you type help case
, only the case usage documentation is printed:
case [<text>] [--mode]
<text>
This text is transformed into upper or lower case.
--mode=<upper|lower>
How to transform the text.
Transforms its argument into upper or lower case depending on the --mode.
You may even print usage documentation for several commands with help echo case
:
echo [<text>]
<text>
This text is echoed.
Echos a string.
case [<text>] [--mode]
<text>
This text is transformed into upper or lower case.
--mode=<upper|lower>
How to transform the text.
Transforms its argument into upper or lower case depending on the --mode.
Commands are executed as expected.
E.g. case 'Foo Bar' --mode upper
prints:
FOO BAR
While case 'Foo Bar' --mode lower
prints:
foo bar
Error messages from the parser are printed in the REPL.
E.g. if you use an unknown --mode
in case
, like in case 'Foo Bar' --mode camel
:
ValueRestrictionsViolated: A value lies outside the allowed values of an option.
Foo Bar
Please report issues in the shargs
tracker!
shargs-example-repl
is MIT licensed.