Skip to content

Commit 8022fd4

Browse files
author
Ivan Demidov
committed
Update successor, see changelog
1 parent eb0e0ef commit 8022fd4

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

cli.js

+11-23
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,24 @@
33
var posthtml = require('posthtml');
44
var fs = require('fs');
55
var argv = require('yargs')
6-
.usage('Usage: $0 [--config|-c config.json] [--output|-o output.html] [--input|-i input.html]')
7-
.example('posthtml -o output.html input.html', 'Default example')
8-
.pkgConf('posthtml')
9-
.config('c', {
10-
config: true
11-
})
12-
.alias('c', 'config')
6+
.usage('Usage: $0 --output|-o output.html --input|-i input.html [--config|-c config.json]')
7+
.example('posthtml -o output.html -i input.html', 'Default example')
138
.alias('i', 'input')
149
.alias('o', 'output')
15-
.requiresArg(['o'])
16-
.version(function () {
17-
return [
18-
'posthtml version',
19-
require('./node_modules/posthtml/package.json').version
20-
].join(' ');
21-
}, 'v')
10+
.demand(['o', 'i'])
11+
.pkgConf('posthtml')
12+
.config('c')
13+
.alias('c', 'config')
14+
.version(function() {
15+
return require('./package.json').version;
16+
})
2217
.alias('v', 'version')
2318
.help('h')
2419
.alias('h', 'help')
25-
.check(function (argv) {
26-
if (!argv.input) {
27-
throw new Error('Not einter argument --input or -i file');
28-
}
29-
if (!argv.output) {
30-
throw new Error('Not einter argument --output or -o file');
31-
}
32-
return true;
33-
})
3420
.argv;
3521

22+
console.log(argv);
23+
3624
// get htmls
3725
var html = fs.readFileSync(argv.input, 'utf8');
3826

0 commit comments

Comments
 (0)