Render the options of a commander app as markdown
$ npm install commander-to-markdown
Say you have a commander app which looks like this:
const program = ;programarguments'<address>' 'Address for delivery';
commanderToMarkdown is pretty much like the
require function – only instead of the app itself, you get the program’s options rendered as markdown:
▸ const commanderToMarkdown = require'commander-to-markdown';▸ commanderToMarkdown`$__dirname/app`;◂ '''#### `<address>`Address for delivery.#### `-p, --peppers`Add peppers.#### `-P, --pineapple`Add pineapple.#### `-b, --bbq-sauce`Add bbq sauce.#### `-c, --cheese [type]`Pick the type of cheese. Default: `marble`.'''
Here’s how it looks rendered.
Address for delivery.
Add bbq sauce.
-c, --cheese [type]
Pick the type of cheese. Default:
This looks especially good when rendered as a manpage with marked-man.
Preventing the program from executing
To prevent executing the program, we stub out your
require('..') with an empty function which returns an object. If that’s not enough for you, you can pass us the option
- At the moment we only accept an absolute path.