From 25c30732826b75420bab6287bfe7cbbc9f75e3b5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 6 Jun 2017 17:54:49 -0400 Subject: getopt, fixes, & naming command line options related --- src/sdp/output/epub3.d | 20 ++++++------ src/sdp/output/html.d | 36 ++++++++++----------- src/sdp/output/hub.d | 69 ++++++++++++++++++++--------------------- src/sdp/output/source_sisupod.d | 18 +++++------ 4 files changed, 71 insertions(+), 72 deletions(-) (limited to 'src/sdp/output') diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d index 00814d4..25f25d5 100644 --- a/src/sdp/output/epub3.d +++ b/src/sdp/output/epub3.d @@ -356,13 +356,13 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); } break; @@ -380,14 +380,14 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -403,7 +403,7 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -442,14 +442,14 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -485,14 +485,14 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -501,7 +501,7 @@ template outputEPub3() { case "comment": break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); } break; diff --git a/src/sdp/output/html.d b/src/sdp/output/html.d index b12be65..8903e51 100644 --- a/src/sdp/output/html.d +++ b/src/sdp/output/html.d @@ -37,14 +37,14 @@ template outputHTML() { doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -61,7 +61,7 @@ template outputHTML() { doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -90,14 +90,14 @@ template outputHTML() { doc_html ~= xhtml_format.table(obj, _txt); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -127,14 +127,14 @@ template outputHTML() { doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -143,7 +143,7 @@ template outputHTML() { case "comment": break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -251,13 +251,13 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); } break; @@ -274,14 +274,14 @@ template outputHTML() { doc_html[segment_filename] ~= to!string(t[0]); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -297,7 +297,7 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -335,14 +335,14 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= ""; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -378,14 +378,14 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -394,7 +394,7 @@ template outputHTML() { case "comment": break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); } break; diff --git a/src/sdp/output/hub.d b/src/sdp/output/hub.d index 79b8996..fd64851 100644 --- a/src/sdp/output/hub.d +++ b/src/sdp/output/hub.d @@ -14,64 +14,63 @@ template outputHub() { void outputHub(D,I)(D doc_abstraction, I doc_matters) { mixin SiSUoutputRgxInit; auto rgx = Rgx(); - if ((doc_matters.opt_action_bool["verbose"])) { + if ((doc_matters.opt_action["verbose"])) { writeln(doc_matters.keys_seq.seg); } - if ((doc_matters.opt_action_bool["source"]) - || (doc_matters.opt_action_bool["sisupod"])) { - if ((doc_matters.opt_action_bool["verbose"]) - && (doc_matters.opt_action_bool["source"])) - { write("sisu source processing... "); } - if ((doc_matters.opt_action_bool["verbose"]) - && (doc_matters.opt_action_bool["sisupod"])) - { write("sisupod source processing... "); } + if ((doc_matters.opt_action["source"]) + || (doc_matters.opt_action["sisupod"])) { + if ((doc_matters.opt_action["verbose"]) + && (doc_matters.opt_action["source"])) + { writeln("sisu source processing... "); } + if ((doc_matters.opt_action["verbose"]) + && (doc_matters.opt_action["sisupod"])) + { writeln("sisupod source processing... "); } SiSUpod!()(doc_matters); - if ((doc_matters.opt_action_bool["verbose"]) - && (doc_matters.opt_action_bool["source"])) + if ((doc_matters.opt_action["verbose"]) + && (doc_matters.opt_action["source"])) { writeln("sisu source done"); } - if ((doc_matters.opt_action_bool["verbose"]) - && (doc_matters.opt_action_bool["sisupod"])) + if ((doc_matters.opt_action["verbose"]) + && (doc_matters.opt_action["sisupod"])) { writeln("sisupod done"); } } - if (doc_matters.opt_action_bool["text"]) { + if (doc_matters.opt_action["text"]) { /+ mixin outputText; +/ - writeln("text processing"); + if ((doc_matters.opt_action["verbose"])) { writeln("text processing... "); } } - if (doc_matters.opt_action_bool["html"]) { - if ((doc_matters.opt_action_bool["verbose"])) { write("html scroll processing... "); } + if (doc_matters.opt_action["html"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("html scroll processing... "); } outputHTML!().scroll(doc_abstraction, doc_matters); - if ((doc_matters.opt_action_bool["verbose"])) { writeln("html scroll done"); } - if ((doc_matters.opt_action_bool["verbose"])) { write("html seg processing... "); } + if ((doc_matters.opt_action["verbose"])) { writeln("html scroll done"); } + if ((doc_matters.opt_action["verbose"])) { writeln("html seg processing... "); } outputHTML!().seg(doc_abstraction, doc_matters); - if ((doc_matters.opt_action_bool["verbose"])) { writeln("html seg done"); } - } else if (doc_matters.opt_action_bool["html_seg"]) { - if ((doc_matters.opt_action_bool["verbose"])) { write("html seg processing... "); } + if ((doc_matters.opt_action["verbose"])) { writeln("html seg done"); } + } else if (doc_matters.opt_action["html-seg"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("html seg processing... "); } outputHTML!().seg(doc_abstraction, doc_matters); - if ((doc_matters.opt_action_bool["verbose"])) { writeln("html seg done"); } - } else if (doc_matters.opt_action_bool["html_scroll"]) { - if ((doc_matters.opt_action_bool["verbose"])) { write("html scroll processing... "); } + if ((doc_matters.opt_action["verbose"])) { writeln("html seg done"); } + } else if (doc_matters.opt_action["html-scroll"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("html scroll processing... "); } outputHTML!().scroll(doc_abstraction, doc_matters); - if ((doc_matters.opt_action_bool["verbose"])) { writeln("html scroll done"); } + if ((doc_matters.opt_action["verbose"])) { writeln("html scroll done"); } } - if (doc_matters.opt_action_bool["epub"]) { - if ((doc_matters.opt_action_bool["verbose"])) { write("epub3 processing... "); } + if (doc_matters.opt_action["epub"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("epub3 processing... "); } outputEPub3!()(doc_abstraction, doc_matters); // epub.css_write; - if ((doc_matters.opt_action_bool["verbose"])) { writeln("epub3 done"); } + if ((doc_matters.opt_action["verbose"])) { writeln("epub3 done"); } } - if (doc_matters.opt_action_bool["pdf"]) { + if (doc_matters.opt_action["pdf"]) { /+ mixin outputPDF; +/ writeln("pdf processing"); } - if (doc_matters.opt_action_bool["odt"]) { + if (doc_matters.opt_action["odt"]) { /+ mixin outputODT; +/ writeln("odt processing"); } - if (doc_matters.opt_action_bool["sqlite"]) { - /+ mixin outputSQLite; +/ - writeln("sqlite processing"); + if (doc_matters.opt_action["sqlite"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("sqlite processing... "); } } - if (doc_matters.opt_action_bool["postgresql"]) { + if (doc_matters.opt_action["postgresql"]) { /+ mixin outputPostgreSQL; +/ writeln("pgsql processing"); } diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d index 6c326ac..bb8ea80 100644 --- a/src/sdp/output/source_sisupod.d +++ b/src/sdp/output/source_sisupod.d @@ -27,7 +27,7 @@ template SiSUpod() { assert (doc_matters.source_filename.match(rgx.src_fn)); try { /+ create directory structure +/ - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { if (!exists(pth_sisupod_filesystem.text_root(doc_matters.source_filename))) { pth_sisupod_filesystem.text_root(doc_matters.source_filename).mkdirRecurse; } @@ -68,10 +68,10 @@ template SiSUpod() { auto fn_out = pth_sisupod.image_root(doc_matters.source_filename).to!string ~ "/" ~ image; auto fn_out_filesystem = pth_sisupod_filesystem.image_root(doc_matters.source_filename).to!string ~ "/" ~ image; if (exists(fn_src)) { - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { fn_src.copy(fn_out_filesystem); } - if (doc_matters.opt_action_bool["sisupod"]) { + if (doc_matters.opt_action["sisupod"]) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn_out; auto zip_data = new OutBuffer(); @@ -88,10 +88,10 @@ template SiSUpod() { auto fn_out = pth_sisupod.conf_root(doc_matters.source_filename).to!string ~ "/" ~ "sisu_document_make"; auto fn_out_filesystem = pth_sisupod_filesystem.conf_root(doc_matters.source_filename).to!string ~ "/" ~ "sisu_document_make"; if (exists(fn_src)) { - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { fn_src.copy(fn_out_filesystem); } - if (doc_matters.opt_action_bool["sisupod"]) { + if (doc_matters.opt_action["sisupod"]) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn_out; auto zip_data = new OutBuffer(); @@ -107,10 +107,10 @@ template SiSUpod() { auto fn_out = pth_sisupod.fn_doc(doc_matters.source_filename).to!string; auto fn_out_filesystem = pth_sisupod_filesystem.fn_doc(doc_matters.source_filename).to!string; if (exists(fn_src)) { - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { fn_src.copy(fn_out_filesystem); } - if (doc_matters.opt_action_bool["sisupod"]) { + if (doc_matters.opt_action["sisupod"]) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn_out; auto zip_data = new OutBuffer(); @@ -142,10 +142,10 @@ template SiSUpod() { insert_file, ).to!string; if (exists(fn_src)) { - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { fn_src.copy(fn_out_filesystem); } - if (doc_matters.opt_action_bool["sisupod"]) { + if (doc_matters.opt_action["sisupod"]) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = insert_file; auto zip_data = new OutBuffer(); -- cgit v1.2.3