Created
November 13, 2009 10:51
-
-
Save hns/233749 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helma> var Parser = require('helma/args').Parser; | |
helma> var p = new Parser(); | |
helma> p.addOption("s", "silent", null, "Ignore errors and warnings") | |
helma> p.addOption("x", "extend", "FOO", "Extend core functionality using FOO") | |
helma> p.addOption("v", "verbose", null, "Be verbose") | |
helma> p.help() | |
-s --silent Ignore errors and warnings | |
-x --extend FOO Extend core functionality using FOO | |
-v --verbose Be verbose | |
helma> var args = ["-s", "-x", "foo"]; | |
helma> p.parse(args).toSource() | |
({silent:true, extend:"foo"}) | |
helma> args.toSource() | |
[] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment