aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/sdp.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-06-06 17:54:49 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit25c30732826b75420bab6287bfe7cbbc9f75e3b5 (patch)
tree58bfa09ed313b15c79fdcfd564a357c886a0d3f0 /org/sdp.org
parenttop banner with previous next navigation bar with svg buttons (diff)
getopt, fixes, & naming command line options related
Diffstat (limited to 'org/sdp.org')
-rw-r--r--org/sdp.org104
1 files changed, 52 insertions, 52 deletions
diff --git a/org/sdp.org b/org/sdp.org
index 9280f1d..4a7e848 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -208,7 +208,7 @@ look into using getopt
#+NAME: sdp_args
#+BEGIN_SRC d
-bool[string] _opt_action_bool = [
+bool[string] opts = [
"assertions" : false,
"concordance" : false,
"debug" : false,
@@ -216,8 +216,8 @@ bool[string] _opt_action_bool = [
"docbook" : false,
"epub" : false,
"html" : false,
- "html_seg" : false,
- "html_scroll" : false,
+ "html-seg" : false,
+ "html-scroll" : false,
"manifest" : false,
"ocn" : true,
"odt" : false,
@@ -230,8 +230,8 @@ bool[string] _opt_action_bool = [
"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,
@@ -240,50 +240,50 @@ bool[string] _opt_action_bool = [
"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)) {
@@ -353,7 +353,7 @@ enforce(
#+NAME: sdp_abstraction
#+BEGIN_SRC d
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];
@@ -366,7 +366,7 @@ auto doc_matters = t[dAM.matters];
#+NAME: sdp_each_file_do_debugs_checkdoc
#+BEGIN_SRC d
/+ ↓ debugs +/
-if (doc_matters.opt_action_bool["verbose"]) {
+if (doc_matters.opt_action["verbose"]) {
SiSUabstractionSummary!()(doc_abstraction, doc_matters);
}
#+END_SRC
@@ -376,8 +376,8 @@ if (doc_matters.opt_action_bool["verbose"]) {
#+NAME: sdp_each_file_do_debugs_checkdoc
#+BEGIN_SRC d
/+ ↓ 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);
}
@@ -389,7 +389,7 @@ if ((doc_matters.opt_action_bool["debug"])
#+NAME: sdp_each_file_do_selected_output
#+BEGIN_SRC d
/+ ↓ output hub +/
-if (!(_opt_action_bool["skip_output"])) {
+if (!(opts["skip-output"])) {
outputHub!()(doc_abstraction, doc_matters);
}
#+END_SRC
@@ -510,9 +510,9 @@ static assert(_make_and_meta.length==2);
#+BEGIN_SRC d
/+ ↓ document abstraction: process document, return abstraction as tuple +/
auto da = SiSUdocAbstraction!()(
- (_header_body_inserts[headBody.body_content]),
- (_make_and_meta[makeMeta.make]),
- (_make_and_meta[makeMeta.meta]),
+ _header_body_inserts[headBody.body_content],
+ _make_and_meta[makeMeta.make],
+ _make_and_meta[makeMeta.meta],
opts
);
static assert(!isTypeTuple!(da));
@@ -579,7 +579,7 @@ struct DocumentMatters {
auto _k = _images;
return _k;
}
- auto opt_action_bool() {
+ auto opt_action() {
bool[string] _k = opts;
return _k;
}
@@ -604,7 +604,7 @@ template SiSUabstractionSummary() {
<<abstraction_summary_imports>>
mixin InternalMarkup;
<<abstraction_summary_initialize>>
- if (doc_matters.opt_action_bool["verbose"]) {
+ if (doc_matters.opt_action["verbose"]) {
<<ao_abstraction_summary>>
}
}