From 614e44ad155e693f82a8228897bba2f4869167dd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 22 Feb 2022 14:23:35 -0500 Subject: rethink verbose & debug flags, introduce show --- src/doc_reform/spine.d | 165 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 113 insertions(+), 52 deletions(-) (limited to 'src/doc_reform/spine.d') diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 97cc6b0..91184dc 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -116,13 +116,18 @@ string program_name = "spine"; "concordance" : false, "dark" : false, "debug" : false, - "debug-pod" : false, + "debug-curate" : false, + "debug-curate-authors" : false, + "debug-curate-topics" : false, "debug-epub" : false, "debug-harvest" : false, "debug-html" : false, "debug-latex" : false, "debug-manifest" : false, + "debug-metadata" : false, + "debug-pod" : false, "debug-sqlite" : false, + "debug-stages" : false, "digest" : false, "epub" : false, "curate" : false, @@ -148,10 +153,19 @@ string program_name = "spine"; "quiet" : false, "pod" : false, "serial" : false, - "show-summary" : false, - "show-metadata" : false, - "show-make" : false, "show-config" : false, + "show-curate" : false, + "show-curate-authors" : false, + "show-curate-topics" : false, + "show-epub" : false, + "show-html" : false, + "show-latex" : false, + "show-make" : false, + "show-manifest" : false, + "show-metadata" : false, + "show-pod" : false, + "show-sqlite" : false, + "show-summary" : false, "source" : false, "sqlite-discrete" : false, "sqlite-db-create" : false, @@ -213,14 +227,6 @@ string program_name = "spine"; "curate-authors", "extract info on authors from document header metadata", &opts["curate-authors"], "curate-topics", "extract info on topics from document header metadata", &opts["curate-topics"], "dark", "alternative dark theme", &opts["dark"], - "debug", "debug", &opts["debug"], - "debug-pod", "debug pod", &opts["debug-pod"], - "debug-epub", "debug epub", &opts["debug-epub"], - "debug-harvest", "debug harvest", &opts["debug-harvest"], - "debug-html", "debug html", &opts["debug-html"], - "debug-latex", "debug latex", &opts["debug-latex"], - "debug-manifest", "debug manifest", &opts["debug-manifest"], - "debug-sqlite", "debug sqlite", &opts["debug-sqlite"], "digest", "hash digest for each object", &opts["digest"], "epub", "process epub output", &opts["epub"], "hide-ocn", "object cite numbers", &opts["hide-ocn"], @@ -255,8 +261,17 @@ string program_name = "spine"; "serial", "serial processing", &opts["serial"], "skip-output", "skip output", &opts["skip-output"], "show-config", "show config", &opts["show-config"], + "show-curate", "show curate", &opts["show-curate"], + "show-curate-authors", "show curate authors", &opts["show-curate-authors"], + "show-curate-topics", "show curate topics", &opts["show-curate-topics"], + "show-epub", "show epub", &opts["show-epub"], + "show-html", "show html", &opts["show-html"], + "show-latex", "show latex", &opts["show-latex"], "show-make", "show make", &opts["show-make"], + "show-manifest", "show manifest", &opts["show-manifest"], "show-metadata", "show metadata", &opts["show-metadata"], + "show-pod", "show pod", &opts["show-pod"], + "show-sqlite", "show sqlite", &opts["show-sqlite"], "show-summary", "show summary", &opts["show-summary"], "source", "document markup source", &opts["source"], "set-digest", "default hash digest type (e.g. sha256)", &settings["set-digest"], @@ -284,6 +299,19 @@ string program_name = "spine"; "workon", "(reserved for some matters under development & testing)", &opts["workon"], "xhtml", "xhtml output", &opts["xhtml"], "config", "=/path/to/config/file/including/filename", &settings["config"], + "debug", "debug", &opts["debug"], + "debug-curate", "debug curate", &opts["debug-curate"], + "debug-curate-authors", "debug curate authors", &opts["debug-curate-authors"], + "debug-curate-topics", "debug curate topics", &opts["debug-curate-topics"], + "debug-epub", "debug epub", &opts["debug-epub"], + "debug-harvest", "debug harvest", &opts["debug-harvest"], + "debug-html", "debug html", &opts["debug-html"], + "debug-latex", "debug latex", &opts["debug-latex"], + "debug-manifest", "debug manifest", &opts["debug-manifest"], + "debug-metadata", "debug metadata", &opts["debug-metadata"], + "debug-pod", "debug pod", &opts["debug-pod"], + "debug-sqlite", "debug sqlite", &opts["debug-sqlite"], + "debug-stages", "debug stages", &opts["debug-stages"], // "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], ); if (helpInfo.helpWanted) { @@ -316,20 +344,19 @@ string program_name = "spine"; } @trusted bool debug_do() { bool _dbg; - if (opts["debug"] - ||opts["debug-epub"] - ||opts["debug-harvest"] - ||opts["debug-html"] - ||opts["debug-latex"] - ||opts["debug-manifest"] - ||opts["debug-sqlite"] - ) { + if (opts["debug"]) { _dbg = true; } else { _dbg = false; } return _dbg; } - @trusted bool debug_do_pod() { - return (opts["debug"] || opts["debug-pod"]) ? true : false; + @trusted bool debug_do_curate() { + return (opts["debug"] || opts["debug-curate"]) ? true : false; + } + @trusted bool debug_do_curate_authors() { + return (opts["debug"] || opts["debug-curate"] || opts["debug-curate-authors"]) ? true : false; + } + @trusted bool debug_do_curate_topics() { + return (opts["debug"] || opts["debug-curate"] || opts["debug-curate-topics"]) ? true : false; } @trusted bool debug_do_epub() { return (opts["debug"] || opts["debug-epub"]) ? true : false; @@ -346,9 +373,18 @@ string program_name = "spine"; @trusted bool debug_do_manifest() { return (opts["debug"] || opts["debug-manifest"]) ? true : false; } + @trusted bool debug_do_metadata() { + return (opts["debug"] || opts["debug-metadata"]) ? true : false; + } + @trusted bool debug_do_pod() { + return (opts["debug"] || opts["debug-pod"]) ? true : false; + } @trusted bool debug_do_sqlite() { return (opts["debug"] || opts["debug-sqlite"]) ? true : false; } + @trusted bool debug_do_stages() { + return (opts["debug"] || opts["debug-stages"]) ? true : false; + } @trusted bool debug_do_xmls() { return (opts["debug"] || opts["debug-html"] || opts["debug-epub"]) ? true : false; } @@ -409,17 +445,44 @@ string program_name = "spine"; @trusted bool pod() { return opts["pod"]; } - @trusted bool show_summary() { - return opts["show-summary"]; + @trusted bool show_config() { + return opts["show-config"]; + } + @trusted bool show_curate() { + return opts["show-curate"]; + } + @trusted bool show_curate_authors() { + return (opts["show-curate"] || opts["show-curate-authors"] || opts["verbose"] || opts["very-verbose"]) ? true : false; + } + @trusted bool show_curate_topics() { + return (opts["show-curate"] || opts["show-curate-topics"] || opts["very-verbose"]) ? true : false; + } + @trusted bool show_epub() { + return opts["show-epub"]; + } + @trusted bool show_html() { + return opts["show-html"]; + } + @trusted bool show_latex() { + return opts["show-latex"]; } @trusted bool show_make() { return opts["show-make"]; } + @trusted bool show_manifest() { + return opts["show-manifest"]; + } @trusted bool show_metadata() { return opts["show-metadata"]; } - @trusted bool show_config() { - return opts["show-config"]; + @trusted bool show_pod() { + return opts["show-pod"]; + } + @trusted bool show_sqlite() { + return (opts["show-sqlite"] || opts["very-verbose"]) ? true : false; + } + @trusted bool show_summary() { + return (opts["show-summary"] || opts["verbose"] || opts["very-verbose"]) ? true : false; } @trusted bool source() { return opts["source"]; @@ -720,13 +783,13 @@ string program_name = "spine"; } if (!(_opt_action.skip_output)) { if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { writeln("step0 commence → (without processing files)"); } outputHubOp!()(_env, _opt_action, _siteConfig); if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { writeln("- step0 complete"); } @@ -924,23 +987,21 @@ string program_name = "spine"; manifest.src.filename ~ "»" ); if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("--->\nstepX commence → (document abstraction)"); + writeln("--->\nstepX commence → (document abstraction) [", manifest.src.filename, "]"); } auto t = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; if ((doc_matters.opt.action.debug_do) - || (doc_matters.opt.action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- stepX complete"); + writeln("- stepX complete for [", manifest.src.filename, "]"); } /+ ↓ debugs +/ - if (doc_matters.opt.action.verbose - || doc_matters.opt.action.show_summary - ) { + if (doc_matters.opt.action.show_summary) { import doc_reform.meta.metadoc_show_summary; spineMetaDocSummary!()(doc_abstraction, doc_matters); } @@ -968,7 +1029,8 @@ string program_name = "spine"; hvst.curates ~= _hvst; } else { if ((doc_matters.opt.action.debug_do) - || (doc_matters.opt.action.very_verbose) + || (_opt_action.debug_do_curate) + || (doc_matters.opt.action.very_verbose) ) { writeln("WARNING curate: document header yaml does not contain information related to: title or author: ", _hvst.path_html_segtoc); } @@ -981,15 +1043,15 @@ string program_name = "spine"; /+ ↓ output hub +/ if (!(doc_matters.opt.action.skip_output)) { if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("step5 commence → (process outputs)"); + writeln("step5 commence → (process outputs) [", manifest.src.filename, "]"); } doc_abstraction.outputHub!()(doc_matters); if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- step5 complete"); + writeln("- step5 complete for [", manifest.src.filename, "]"); } } scope(exit) { @@ -1038,23 +1100,21 @@ string program_name = "spine"; manifest.src.filename ~ "»" ); if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("--->\nstepX commence → (document abstraction)"); + writeln("--->\nstepX commence → (document abstraction) [", manifest.src.filename, "]"); } auto t = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; if ((doc_matters.opt.action.debug_do) - || (doc_matters.opt.action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- stepX complete"); + writeln("- stepX complete for [", manifest.src.filename, "]"); } /+ ↓ debugs +/ - if (doc_matters.opt.action.verbose - || doc_matters.opt.action.show_summary - ) { + if (doc_matters.opt.action.show_summary) { import doc_reform.meta.metadoc_show_summary; spineMetaDocSummary!()(doc_abstraction, doc_matters); } @@ -1082,7 +1142,8 @@ string program_name = "spine"; hvst.curates ~= _hvst; } else { if ((doc_matters.opt.action.debug_do) - || (doc_matters.opt.action.very_verbose) + || (_opt_action.debug_do_curate) + || (doc_matters.opt.action.very_verbose) ) { writeln("WARNING curate: document header yaml does not contain information related to: title or author: ", _hvst.path_html_segtoc); } @@ -1095,15 +1156,15 @@ string program_name = "spine"; /+ ↓ output hub +/ if (!(doc_matters.opt.action.skip_output)) { if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("step5 commence → (process outputs)"); + writeln("step5 commence → (process outputs) [", manifest.src.filename, "]"); } doc_abstraction.outputHub!()(doc_matters); if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- step5 complete"); + writeln("- step5 complete for [", manifest.src.filename, "]"); } } scope(exit) { -- cgit v1.2.3