From 10a35299c2c1d77a97caaddc3f5d56778013c781 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 4 Jul 2020 18:49:55 +0300 Subject: [PATCH] docs... Signed-off-by: Alex A. Naanou --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 17c23a4..9e54a41 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,53 @@ Now for the code var argv = require('ig-argv') var parser = argv.Parser({ - // XXX + // basic/quick option... + '-b': '-basic', + '-basic': function(){ + // ... + }, + + // full option settings... + '-f': '-full', + '-full': { + doc: 'Option help', + // option value to be displayed in help (optional) + arg: 'VALUE', + + // value key (optional) + // NOTE: if .handler(..) is defined this is ignored. + key: 'fullValue', + // envioroment value (optional) + env: 'VALUE', + // default value (optional) + default: 123, + // required status (optional) + required: true, + + // handler (optional) + handler: function(opts, key, value){ + // ... + }, + }, + + // command... + // NOTE: the only difference between an option and a command is + // the prefix ('-' vs. '@') that determines how it is parsed, + // otherwise they are identical and can alias each other... + '@cmd', '@command', + '@command': { + // ... + }, + + // example command-option alias... + '@help': '-help', + + // nested parser... + '@nested': argv.Parser({ + // ... + }).then(function(){ + // ... + }), }) .then(function(){ // XXX @@ -79,6 +125,8 @@ This will create a parser that supports the folowing: $ ./script.js --help ``` +## Configuration + ## License