@@ -11,6 +11,9 @@ function showHelp() {
1111    console . log ( "rustdoc-js options:" ) ; 
1212    console . log ( "  --doc-folder [PATH]        : location of the generated doc folder" ) ; 
1313    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" ) ; 
1417    console . log ( "  --help                     : show this message then quit" ) ; 
1518    console . log ( "  --tests-folder [PATH]      : location of the .GOML tests folder" ) ; 
1619} 
@@ -20,10 +23,16 @@ function parseOptions(args) {
2023        "doc_folder" : "" , 
2124        "tests_folder" : "" , 
2225        "files" : [ ] , 
26+         "debug" : false , 
27+         "show_text" : false , 
28+         "no_headless" : false , 
2329    } ; 
2430    var  correspondances  =  { 
2531        "--doc-folder" : "doc_folder" , 
2632        "--tests-folder" : "tests_folder" , 
33+         "--debug" : "debug" , 
34+         "--show-text" : "show_text" , 
35+         "--no-headless" : "no_headless" , 
2736    } ; 
2837
2938    for  ( var  i  =  0 ;  i  <  args . length ;  ++ i )  { 
@@ -43,6 +52,8 @@ function parseOptions(args) {
4352        }  else  if  ( args [ i ]  ===  "--help" )  { 
4453            showHelp ( ) ; 
4554            process . exit ( 0 ) ; 
55+         }  else  if  ( correspondances [ args [ i ] ] )  { 
56+             opts [ correspondances [ args [ i ] ] ]  =  true ; 
4657        }  else  { 
4758            console . log ( "Unknown option `"  +  args [ i ]  +  "`." ) ; 
4859            console . log ( "Use `--help` to see the list of options" ) ; 
@@ -68,17 +79,20 @@ async function main(argv) {
6879    const  options  =  new  Options ( ) ; 
6980    try  { 
7081        // This is more convenient that setting fields one by one. 
71-         options . parseArguments ( [ 
82+         let   args   =   [ 
7283            "--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", 
8084            "--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 ) ; 
8296    }  catch  ( error )  { 
8397        console . error ( `invalid argument: ${ error }  ) ; 
8498        process . exit ( 1 ) ; 
0 commit comments