Skip to content

pixeldroid/optionparser-ls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

optionparser-ls

a simple option parser for Loom commandline apps

installation

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

usage

  1. declare a reference to the OptionParser loomlib in your .build file:
    "references": [
        "System",
        "OptionParser"
    ],
  2. import pixeldroid.cli.OptionParser
  3. instantiate a new pixeldroid.cli.OptionParser and call the parse() method on it
  4. retrieve pixeldroid.cli.Option items via the getOption() method of OptionParser

OptionParserDemo

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']

building

first, install loomtasks and the spec-ls library

compiling from source

$ rake lib:install

this will build the OptionParser library and install it in the currently configured sdk

running tests

$ rake test

this will build the OptionParser library, install it in the currently configured sdk, build the test app, and run the test app.

contributing

Pull requests are welcome!