-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathcli.js
executable file
·44 lines (38 loc) · 982 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
'use strict';
var yargs = require('yargs');
yargs
.version()
.alias('v', 'version')
.option('h', {
alias: 'help',
description: 'Show help'
})
.option('q', {
alias: 'quiet',
description: 'Quiet mode. Only print errors',
type: 'boolean',
default: false
})
.option('m', {
alias: 'mute',
description: 'Mute mode. Does not print anything',
type: 'boolean',
default: false
})
.usage('Usage: mldoc <command> [options]')
.demand(1, 'You must provide a valid command')
.command('convert', 'Converts files')
.example('mldoc convert -i foo.org -o bar.html', 'Converts \'foo.org\' to \'bar.html\'')
.wrap(yargs.terminalWidth());
var argv = yargs.argv,
command = argv._[0];
if (command === 'convert') {
require('./convert.cmd.js').run();
} else {
yargs.showHelp();
}
if (argv.help) {
yargs.showHelp();
}
process.exit(0);