a simple option parser for Loom commandline apps
Download the library into its matching sdk folder:
$ curl -L -o ~/.loom/sdks/sprint34/libs/OptionParser.loomlib \
https://github.com/pixeldroid/optionparser-ls/releases/download/v2.1.1/OptionParser-sprint34.loomlib
To uninstall, simply delete the file:
$ rm ~/.loom/sdks/sprint34/libs/OptionParser.loomlib
- declare a reference to the OptionParser loomlib in your
.build
file:"references": [ "System", "OptionParser" ],
- import
pixeldroid.cli.OptionParser
- instantiate a new
pixeldroid.cli.OptionParser
and call theparse()
method on it - retrieve
pixeldroid.cli.Option
items via thegetOption()
method of OptionParser
see an example of using the OptionParser here:
you can compile and run the demo from the command line:
$ cd test
$ ~/.loom/sdks/sprint34/bin/osx-x64/tools/lsc OptionParserDemoCLI.build
$ mv bin/OptionParserDemoCLI.loom bin/Main.loom
$ ~/.loom/sdks/sprint34/bin/osx-x64/tools/loomexec // --help
$ ~/.loom/sdks/sprint34/bin/osx-x64/tools/loomexec // --optionA arg1 arg2 -b
or use Rake:
$ rake cli['--optionA arg1 arg2 -b']
first, install loomtasks and the spec-ls library
$ rake lib:install
this will build the OptionParser library and install it in the currently configured sdk
$ rake test
this will build the OptionParser library, install it in the currently configured sdk, build the test app, and run the test app.
Pull requests are welcome!