Table of Contents
lipsum(1)
Canonical example for the command module.
Install
npm i -g cli-lipsum
Definition
The lipsum
program was configured using this markdown definition file, see lipsum.md for the raw version, check out usage to see the resulting help output from combining the definition with the source.
Source
Code from lipsum.js:
var util = ;var glue = ;var CommandInterface = glueCommandInterface;var cli = gluecli help = clihelp; var fs = ;var path = ;var convert = ;var formats = fmtformats;var lipsum = '' + fs;var paragraphs = lipsum; var list = null true false 1 -1;var alignments = 'column' 'line' 'flex' 'wrap';var stash = {}; // command handlers { var keys = keys; var log = thislog; keys} { this;} // add mock options and commands { this var program = this; paragraphs} // properties to associate with the commands// and options loaded from lipsum.mdvar options = commands: print: print exception: exception options: sort: clitypes format: clitypes align: clitypes maximum: clitypesinteger ; var { CommandInterface;} util; LoremIpsumprototype { var file = path; var conf = trace: processenvNODE_ENV === 'devel' load: file: file options: options substitute: enabled: true manual: dir: path dynamic: true ; var hints = values: format: formats align: alignments sort: list maximum: 60 240 this //.usage(usage) //.usage(false) //.usage(null) ;} var midcolor = midlogger = middebug = midmanual = LoremIpsumprototype { this ;} LoremIpsumprototype { this ;} module { return pkg;}
Usage
This is the help output which is the result of combining the markdown definition with the source code.
Usage: lipsum <command> [-ljcveh] [--color|--no-color]
[--debug] [-l|--latin] [-j|--json] [-c|--collapse]
[-v|--vanilla] [-e|--exit] [-h|--help] [--version]
[--log-level=<level>] [--log-file=<file>]
[-s|--sort=(null|true|false|1|-1)]
[-f|--format=(text|json|markdown|man)]
[-a|--align=(column|line|flex|wrap)]
[-m|--maximum=<60-240>] <args>
Canonical example for the command module.
Commands:
help Show help for commands.
print, p Print some messages using the log middleware.
exception, ex, e Throw an exception.
Options:
-v, --vanilla Disable parameter replacement.
--[no]-color Enable or disable terminal colors.
--log-file=[file]
Redirect to log file.
--debug Enable stack traces.
-l, --latin Include mock lipsum options and commands.
-j, --json Print help as json.
-c, --collapse Collapse whitespace between sections.
--log-level=[level]
Set the log level.
-e, --exit Include exit section from error definitions.
-s, --sort=[value] Alters the help option sort order. Set to null to use
natural order which is likely the order that options were
declared in however this is not guaranteed. Use false for
the default sorting logic which favours options with more
names, use true to sort lexicographically using
Array.prototype.sort. Use 1 to sort by option string length
(determined by the length of the help option string),
reverse the order with -1.
-f, --format=[value]
Set the help output format.
-a, --align=[value]
Alignment style.
-m, --maximum=[value]
Maximum column width.
-h, --help Display this help and exit.
--version Output version information and exit.
Report bugs to muji <noop@xpm.io>.
Screenshot
License
Everything is MIT. Read the license if you feel inclined.
This program was built using the command module, if you care for excellent documentation and write command line interfaces you should check it out.
Generated by mdp(1).