File tree 1 file changed +11
-23
lines changed
1 file changed +11
-23
lines changed Original file line number Diff line number Diff line change 3
3
var posthtml = require ( 'posthtml' ) ;
4
4
var fs = require ( 'fs' ) ;
5
5
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' )
13
8
. alias ( 'i' , 'input' )
14
9
. 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
+ } )
22
17
. alias ( 'v' , 'version' )
23
18
. help ( 'h' )
24
19
. 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
- } )
34
20
. argv ;
35
21
22
+ console . log ( argv ) ;
23
+
36
24
// get htmls
37
25
var html = fs . readFileSync ( argv . input , 'utf8' ) ;
38
26
You can’t perform that action at this time.
0 commit comments