1- // A helper to update test data generated from input.gmi .
1+ // A helper to update generated test data .
22package main
33
44import (
@@ -27,9 +27,10 @@ func printerrln(a ...any) (int, error) {
2727func main () {
2828 flag .CommandLine .Init ("" , flag .ContinueOnError )
2929 flag .CommandLine .SetOutput (io .Discard )
30- updateInputDump := flag .Bool ("input-dump" , false , "" )
31- updateOutputGMI := flag .Bool ("output-gmi" , false , "" )
32- updateOutputHTML := flag .Bool ("output-html" , false , "" )
30+ updateDump := flag .Bool ("dump" , false , "" )
31+ updateGMI := flag .Bool ("gmi" , false , "" )
32+ updateHTML := flag .Bool ("html" , false , "" )
33+ updateListOnlyHTML := flag .Bool ("list-only-html" , false , "" )
3334 flag .Parse ()
3435
3536 if flag .NArg () > 0 || flag .NFlag () < 1 {
@@ -76,7 +77,12 @@ func main() {
7677 printerrln (err )
7778 }
7879
79- if * updateInputDump {
80+ listOnlyASL , err := p .ParseFile (filepath .Join (testdataDir , "input_list_only.gmi" ))
81+ if err != nil {
82+ printerrln (err )
83+ }
84+
85+ if * updateDump {
8086 if err := os .WriteFile (
8187 filepath .Join (testdataDir , "input.dump" ),
8288 []byte (dumper .Sdump (asl )),
@@ -86,7 +92,7 @@ func main() {
8692 }
8793 }
8894
89- if * updateOutputGMI {
95+ if * updateGMI {
9096 if err := p .ToGemtextFile (
9197 filepath .Join (testdataDir , "output.gmi" ),
9298 asl ,
@@ -96,7 +102,7 @@ func main() {
96102 }
97103 }
98104
99- if * updateOutputHTML {
105+ if * updateHTML {
100106 if err := p .ToHTMLFile (
101107 filepath .Join (testdataDir , "output.html" ),
102108 asl ,
@@ -105,4 +111,14 @@ func main() {
105111 printerrln (err )
106112 }
107113 }
114+
115+ if * updateListOnlyHTML {
116+ if err := p .ToHTMLFile (
117+ filepath .Join (testdataDir , "output_list_only.html" ),
118+ listOnlyASL ,
119+ 0600 ,
120+ ); err != nil {
121+ printerrln (err )
122+ }
123+ }
108124}
0 commit comments