diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-06-06 17:54:49 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 25c30732826b75420bab6287bfe7cbbc9f75e3b5 (patch) | |
tree | 58bfa09ed313b15c79fdcfd564a357c886a0d3f0 /src/sdp/sdp.d | |
parent | top banner with previous next navigation bar with svg buttons (diff) |
getopt, fixes, & naming command line options related
Diffstat (limited to 'src/sdp/sdp.d')
-rwxr-xr-x | src/sdp/sdp.d | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d index 234bc3f..3816f9b 100755 --- a/src/sdp/sdp.d +++ b/src/sdp/sdp.d @@ -59,7 +59,7 @@ void main(string[] args) { ); } } - bool[string] _opt_action_bool = [ + bool[string] opts = [ "assertions" : false, "concordance" : false, "debug" : false, @@ -67,8 +67,8 @@ void main(string[] args) { "docbook" : false, "epub" : false, "html" : false, - "html_seg" : false, - "html_scroll" : false, + "html-seg" : false, + "html-scroll" : false, "manifest" : false, "ocn" : true, "odt" : false, @@ -81,8 +81,8 @@ void main(string[] args) { "text" : false, "verbose" : false, "xhtml" : false, - "xml_dom" : false, - "xml_sax" : false, + "xml-dom" : false, + "xml-sax" : false, "section_toc" : true, "section_body" : true, "section_endnotes" : true, @@ -91,50 +91,50 @@ void main(string[] args) { "section_bookindex" : true, "section_blurb" : true, "backmatter" : true, - "skip_output" : false, + "skip-output" : false, ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, - "assert", "--assert set optional assertions on", &_opt_action_bool["assertions"], - "concordance", "--concordance file for document", &_opt_action_bool["concordance"], - "debug", "--debug only relevant when debug options compiled in", &_opt_action_bool["debug"], - "digest", "--digest hash digest for each object", &_opt_action_bool["digest"], - "docbook", "--docbook process docbook output", &_opt_action_bool["docbook"], - "epub", "--epub process epub output", &_opt_action_bool["epub"], - "html", "--html process html output", &_opt_action_bool["html"], - "html_seg", "--html-seg process html output", &_opt_action_bool["html_seg"], - "html_scroll", "--html-seg process html output", &_opt_action_bool["html_scroll"], - "manifest", "--manifest process manifest output", &_opt_action_bool["manifest"], - "ocn", "--ocn object cite numbers (default)", &_opt_action_bool["ocn"], - "odf", "--odf process odf:odt output", &_opt_action_bool["odt"], - "odt", "--odt process odf:odt output", &_opt_action_bool["odt"], - "pdf", "--pdf process pdf output", &_opt_action_bool["pdf"], - "pg", "--pg process postgresql output", &_opt_action_bool["postgresql"], - "postgresql", "--postgresql process postgresql output", &_opt_action_bool["postgresql"], - "qrcode", "--qrcode with document metadata", &_opt_action_bool["qrcode"], - "sisupod", "--sisupod sisupod source content bundled", &_opt_action_bool["sisupod"], - "source", "--source markup source text content", &_opt_action_bool["source"], - "sqlite", "--sqlite process sqlite output", &_opt_action_bool["sqlite"], - "text", "--text process text output", &_opt_action_bool["text"], - "txt", "--txt process text output", &_opt_action_bool["text"], - "verbose|v", "--verbose output to terminal", &_opt_action_bool["verbose"], - "xhtml", "--xhtml process xhtml output", &_opt_action_bool["xhtml"], - "xml-dom", "--xml-dom process xml dom output", &_opt_action_bool["xml_dom"], - "xml-sax", "--xml-sax process xml sax output", &_opt_action_bool["xml_sax"], - "section-toc", "--section-toc process table of contents (default)", &_opt_action_bool["section_toc"], - "section-body", "--section-body process document body (default)", &_opt_action_bool["section_body"], - "section-endnotes", "--section-endnotes process document endnotes (default)", &_opt_action_bool["section_endnotes"], - "section-glossary", "--section-glossary process document glossary (default)", &_opt_action_bool["section_glossary"], - "section-biblio", "--section-biblio process document biblio (default)", &_opt_action_bool["section_biblio"], - "section-bookindex", "--section-bookindex process document bookindex (default)", &_opt_action_bool["section_bookindex"], - "section-blurb", "--section-blurb process document blurb (default)", &_opt_action_bool["section_blurb"], - "backmatter", "--section-backmatter process document backmatter (default)", &_opt_action_bool["backmatter"], - "skip_output", "--skip-output", &_opt_action_bool["skip_output"], + "assert", "--assert set optional assertions on", &opts["assertions"], + "concordance", "--concordance file for document", &opts["concordance"], + "debug", "--debug only relevant when debug options compiled in", &opts["debug"], + "digest", "--digest hash digest for each object", &opts["digest"], + "docbook", "--docbook process docbook output", &opts["docbook"], + "epub", "--epub process epub output", &opts["epub"], + "html", "--html process html output", &opts["html"], + "html-seg", "--html-seg process html output", &opts["html-seg"], + "html-scroll", "--html-seg process html output", &opts["html-scroll"], + "manifest", "--manifest process manifest output", &opts["manifest"], + "ocn", "--ocn object cite numbers (default)", &opts["ocn"], + "odf", "--odf process odf:odt output", &opts["odt"], + "odt", "--odt process odf:odt output", &opts["odt"], + "pdf", "--pdf process pdf output", &opts["pdf"], + "pg", "--pg process postgresql output", &opts["postgresql"], + "postgresql", "--postgresql process postgresql output", &opts["postgresql"], + "qrcode", "--qrcode with document metadata", &opts["qrcode"], + "sisupod", "--sisupod sisupod source content bundled", &opts["sisupod"], + "source", "--source markup source text content", &opts["source"], + "sqlite", "--sqlite process sqlite output", &opts["sqlite"], + "text", "--text process text output", &opts["text"], + "txt", "--txt process text output", &opts["text"], + "verbose|v", "--verbose output to terminal", &opts["verbose"], + "xhtml", "--xhtml process xhtml output", &opts["xhtml"], + "xml-dom", "--xml-dom process xml dom output", &opts["xml-dom"], + "xml-sax", "--xml-sax process xml sax output", &opts["xml-sax"], + "section-toc", "--section-toc process table of contents (default)", &opts["section_toc"], + "section-body", "--section-body process document body (default)", &opts["section_body"], + "section-endnotes", "--section-endnotes process document endnotes (default)", &opts["section_endnotes"], + "section-glossary", "--section-glossary process document glossary (default)", &opts["section_glossary"], + "section-biblio", "--section-biblio process document biblio (default)", &opts["section_biblio"], + "section-bookindex", "--section-bookindex process document bookindex (default)", &opts["section_bookindex"], + "section-blurb", "--section-blurb process document blurb (default)", &opts["section_blurb"], + "backmatter", "--section-backmatter process document backmatter (default)", &opts["backmatter"], + "skip-output", "--skip-output", &opts["skip-output"], ); if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); } - foreach(arg; args) { + foreach(arg; args[1..$]) { if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt } else if (arg.match(rgx.src_pth)) { @@ -177,23 +177,23 @@ void main(string[] args) { "not a sisu markup filename" ); auto t = - SiSUabstraction!()(fn_src, _opt_action_bool, env); + SiSUabstraction!()(fn_src, opts, env); static assert(!isTypeTuple!(t)); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; /+ ↓ debugs +/ - if (doc_matters.opt_action_bool["verbose"]) { + if (doc_matters.opt_action["verbose"]) { SiSUabstractionSummary!()(doc_abstraction, doc_matters); } /+ ↓ debugs +/ - if ((doc_matters.opt_action_bool["debug"]) - || (doc_matters.opt_action_bool["verbose"]) + if ((doc_matters.opt_action["debug"]) + || (doc_matters.opt_action["verbose"]) ) { SiSUdebugs!()(doc_abstraction, doc_matters); } /+ ↓ output hub +/ - if (!(_opt_action_bool["skip_output"])) { + if (!(opts["skip-output"])) { outputHub!()(doc_abstraction, doc_matters); } scope(exit) { |