@@ -11,6 +11,9 @@ function showHelp() {
11
11
console . log ( "rustdoc-js options:" ) ;
12
12
console . log ( " --doc-folder [PATH] : location of the generated doc folder" ) ;
13
13
console . log ( " --file [PATH] : file to run (can be repeated)" ) ;
14
+ console . log ( " --debug : show extra information about script run" ) ;
15
+ console . log ( " --show-text : render font in pages" ) ;
16
+ console . log ( " --no-headless : disable headless mode" ) ;
14
17
console . log ( " --help : show this message then quit" ) ;
15
18
console . log ( " --tests-folder [PATH] : location of the .GOML tests folder" ) ;
16
19
}
@@ -20,10 +23,16 @@ function parseOptions(args) {
20
23
"doc_folder" : "" ,
21
24
"tests_folder" : "" ,
22
25
"files" : [ ] ,
26
+ "debug" : false ,
27
+ "show_text" : false ,
28
+ "no_headless" : false ,
23
29
} ;
24
30
var correspondances = {
25
31
"--doc-folder" : "doc_folder" ,
26
32
"--tests-folder" : "tests_folder" ,
33
+ "--debug" : "debug" ,
34
+ "--show-text" : "show_text" ,
35
+ "--no-headless" : "no_headless" ,
27
36
} ;
28
37
29
38
for ( var i = 0 ; i < args . length ; ++ i ) {
@@ -43,6 +52,8 @@ function parseOptions(args) {
43
52
} else if ( args [ i ] === "--help" ) {
44
53
showHelp ( ) ;
45
54
process . exit ( 0 ) ;
55
+ } else if ( correspondances [ args [ i ] ] ) {
56
+ opts [ correspondances [ args [ i ] ] ] = true ;
46
57
} else {
47
58
console . log ( "Unknown option `" + args [ i ] + "`." ) ;
48
59
console . log ( "Use `--help` to see the list of options" ) ;
@@ -68,17 +79,20 @@ async function main(argv) {
68
79
const options = new Options ( ) ;
69
80
try {
70
81
// This is more convenient that setting fields one by one.
71
- options . parseArguments ( [
82
+ let args = [
72
83
"--no-screenshot" ,
73
- // This option shows what puppeteer "code" is run
74
- // "--debug",
75
- // This option disable the headless mode, allowing you to see what's going on.
76
- // "--no-headless",
77
- // The text isn't rendered by default because of a lot of small differences
78
- // between hosts.
79
- // "--show-text",
80
84
"--variable" , "DOC_PATH" , opts [ "doc_folder" ] ,
81
- ] ) ;
85
+ ] ;
86
+ if ( opts [ "debug" ] ) {
87
+ args . push ( "--debug" ) ;
88
+ }
89
+ if ( opts [ "show_text" ] ) {
90
+ args . push ( "--show-text" ) ;
91
+ }
92
+ if ( opts [ "no_headless" ] ) {
93
+ args . push ( "--no-headless" ) ;
94
+ }
95
+ options . parseArguments ( args ) ;
82
96
} catch ( error ) {
83
97
console . error ( `invalid argument: ${ error } ` ) ;
84
98
process . exit ( 1 ) ;
0 commit comments