From 0ad6a4faf3121a4a19b62155604f34d220281d04 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 25 Jan 2019 20:29:59 -0500 Subject: getopt --- org/doc_reform.org | 112 +++++++++++++++++++++-------------------------------- 1 file changed, 44 insertions(+), 68 deletions(-) (limited to 'org/doc_reform.org') diff --git a/org/doc_reform.org b/org/doc_reform.org index 80e703b..9be2480 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -257,10 +257,11 @@ bool[string] opts = [ "light" : false, "manifest" : false, "ocn" : true, - "parallelise" : true, - "parallelise-subprocesses" : false, + "parallel" : false, + "parallel-subprocesses" : false, "quiet" : false, "pod" : false, + "serial" : false, "source" : false, "sqlite-discrete" : false, "sqlite-db-create" : false, @@ -271,7 +272,7 @@ bool[string] opts = [ "sqlite-update" : false, "text" : false, "verbose" : false, - "very-verbose" : false, + "very-verbose" : false, "xhtml" : false, "section_toc" : true, "section_body" : true, @@ -307,10 +308,11 @@ auto helpInfo = getopt(args, "light", "--light default light theme", &opts["light"], "manifest", "--manifest process manifest output", &opts["manifest"], "ocn", "--ocn object cite numbers (default)", &opts["ocn"], - "parallelise", "--parallelise parallelisation", &opts["parallelise"], - "parallelise-subprocesses", "--parallelise-subprocesses nested parallelisation", &opts["parallelise-subprocesses"], + "parallel", "--parallel parallelisation", &opts["parallel"], + "parallel-subprocesses", "--parallel-subprocesses nested parallelisation", &opts["parallel-subprocesses"], "quiet", "--quiet output to terminal", &opts["quiet"], "pod", "--pod doc reform pod source content bundled", &opts["pod"], + "serial", "--serial serial processing", &opts["serial"], "source", "--source markup source text content", &opts["source"], "sqlite-discrete", "--sqlite process discrete sqlite output", &opts["sqlite-discrete"], "sqlite-db-create", "--sqlite-db-create create db, create tables", &opts["sqlite-db-create"], @@ -380,41 +382,27 @@ struct OptActions { return opts["epub"]; } auto html() { - bool _is = ( - opts["html"] - || opts["html-seg"] - || opts["html-scroll"] - ) - ? true - : false; + bool _is; + if ( opts["html"] || opts["html-seg"] || opts["html-scroll"]) + { _is = true; } else { _is = false; } return _is; } auto html_seg() { - bool _is = ( - opts["html"] - || opts["html-seg"] - ) - ? true - : false; + bool _is; + if ( opts["html"] || opts["html-seg"]) + { _is = true; } else { _is = false; } return _is; } auto html_scroll() { - bool _is = ( - opts["html"] - || opts["html-scroll"] - ) - ? true - : false; + bool _is; + if ( opts["html"] || opts["html-scroll"]) + { _is = true; } else { _is = false; } return _is; } auto html_stuff() { - bool _is = ( - opts["html"] - || opts["html-scroll"] - || opts["html-seg"] - ) - ? true - : false; + bool _is; + if (opts["html"] || opts["html-scroll"] || opts["html-seg"]) + { _is = true; } else { _is = false; } return _is; } auto manifest() { @@ -436,57 +424,43 @@ struct OptActions { return opts["sqlite-discrete"]; } auto sqlite_db_drop() { - bool _is = ( - opts["sqlite-db-recreate"] - || opts["sqlite-db-drop"] - ) - ? true - : false; + bool _is; + if ( opts["sqlite-db-recreate"] || opts["sqlite-db-drop"]) + { _is = true; } else { _is = false; } return _is; } auto sqlite_db_create() { - bool _is = ( - opts["sqlite-db-recreate"] - || opts["sqlite-db-create"] - ) - ? true - : false; + bool _is; + if ( opts["sqlite-db-recreate"] || opts["sqlite-db-create"]) + { _is = true; } else { _is = false; } return _is; } auto sqlite_delete() { return opts["sqlite-delete"]; } auto sqlite_update() { - bool _is = ( - opts["sqlite-update"] - || opts["sqlite-insert"] - ) - ? true - : false; + bool _is; + if (opts["sqlite-update"] || opts["sqlite-insert"]) + { _is = true; } else { _is = false; } return _is; } auto sqlite_shared_db_action() { - bool _is = ( - opts["sqlite-db-recreate"] + bool _is; + if (opts["sqlite-db-recreate"] || opts["sqlite-db-create"] || opts["sqlite-delete"] || opts["sqlite-insert"] || opts["sqlite-update"] - ) - ? true - : false; + ) { _is = true; } else { _is = false; } return _is; } auto text() { return opts["text"]; } auto verbose() { - bool _is = ( - opts["verbose"] - || opts["very-verbose"] - ) - ? true - : false; + bool _is; + if (opts["verbose"] || opts["very-verbose"]) + { _is = true; } else { _is = false; } return _is; } auto very_verbose() { @@ -535,12 +509,16 @@ struct OptActions { return settings["sqlite-filename"]; } auto parallelise() { - bool _is = ( opts["parallelise"]) ? true : false; - _is = ( sqlite_shared_db_action ) ? false : true; + bool _is; + if (opts["parallel"] == true + || (opts["parallel"] != false && opts["serial"] == false)) { + _is = true; + if (sqlite_shared_db_action) { _is = false; } + } else { _is = false; } return _is; } auto parallelise_subprocesses() { - return opts["parallelise-subprocesses"]; + return opts["parallel-subprocesses"]; } auto output_task_scheduler() { int[] schedule; @@ -568,8 +546,8 @@ struct OptActions { return schedule.sort().uniq; } auto abstraction() { - bool _is = ( - opts["abstraction"] + bool _is; + if (opts["abstraction"] || concordance || epub || html @@ -579,9 +557,7 @@ struct OptActions { || sqlite_discrete || sqlite_delete || sqlite_update - ) - ? true - : false; + ) { _is = true; } else { _is = false; } return _is; } } -- cgit v1.2.3