[Pkg-javascript-commits] [node-subarg] 06/17: docs

Bastien Roucariès rouca at moszumanska.debian.org
Fri Aug 25 19:28:11 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-subarg.

commit 617ced5755c47c8737b581ce755742575395c035
Author: James Halliday <mail at substack.net>
Date:   Sat Feb 8 20:34:40 2014 -0800

    docs
---
 example/show.js |  3 +++
 readme.markdown | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/example/show.js b/example/show.js
new file mode 100644
index 0000000..f2a73ee
--- /dev/null
+++ b/example/show.js
@@ -0,0 +1,3 @@
+var subarg = require('../');
+var argv = subarg(process.argv.slice(2));
+console.log(argv);
diff --git a/readme.markdown b/readme.markdown
new file mode 100644
index 0000000..8d3549c
--- /dev/null
+++ b/readme.markdown
@@ -0,0 +1,53 @@
+# subarg
+
+parse arguments with recursive contexts using
+[minimist](https://npmjs.org/package/minimist)
+
+This module is useful if you need to pass arguments into a piece of code without
+coordinating ahead of time with the main program, like with a plugin system.
+
+# example
+
+``` js
+var subarg = require('subarg');
+var argv = subarg(process.argv.slice(2));
+console.log(argv);
+```
+
+Contexts are denoted with square brackets:
+
+```
+$ node example/show.js beep --beep [ boop -a 3 ] -n4 --robots [ -x 8 -y 6 ]
+{ _: [ 'beep', ']' ],
+  beep: { _: [ 'boop' ], a: 3 },
+  n: 4,
+  robots: '[',
+  x: 8,
+  y: 6 }
+```
+
+# methods
+
+``` js
+var subarg = require('subarg')
+```
+
+## var argv = subarg(args, opts)
+
+Parse the arguments array `args`, passing `opts` to
+[minimist](https://npmjs.org/package/minimist).
+
+An opening `[` in the `args` array creates a new context and a `]` closes a
+context. Contexts may be nested.
+
+# install
+
+With [npm](https://npmjs.org) do:
+
+```
+npm install subarg
+```
+
+# license
+
+MIT

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-subarg.git



More information about the Pkg-javascript-commits mailing list