From fc2471c91966186fc7bc0a5ac2217496c9e43eea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 16 Jul 2018 22:39:09 -0400 Subject: 0.26.5 sqlite output, focus --- src/sdp/sdp.d | 64 ++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 16 deletions(-) (limited to 'src/sdp/sdp.d') diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d index b703838..50df3f2 100755 --- a/src/sdp/sdp.d +++ b/src/sdp/sdp.d @@ -76,9 +76,12 @@ void main(string[] args) { "sisupod" : false, "source" : false, "sqlite-discrete" : false, + "sqlite-db-create" : false, + "sqlite-db-drop" : false, + "sqlite-db-recreate" : false, + "sqlite-delete" : false, + "sqlite-insert" : false, "sqlite-update" : false, - "sqlite-create" : false, - "sqlite-drop" : false, "text" : false, "verbose" : false, "xhtml" : false, @@ -98,6 +101,7 @@ void main(string[] args) { "output-dir" : "", "site-config-dir" : "", "lang" : "all", + "sqlite-filename" : "documents", ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, @@ -122,8 +126,11 @@ void main(string[] args) { "sisupod", "--sisupod sisupod source content bundled", &opts["sisupod"], "source", "--source markup source text content", &opts["source"], "sqlite-discrete", "--sqlite process discrete sqlite output", &opts["sqlite-discrete"], - "sqlite-create", "--sqlite-create create db, create tables", &opts["sqlite-create"], - "sqlite-drop", "--sqlite-drop drop tables & db", &opts["sqlite-drop"], + "sqlite-db-create", "--sqlite-db-create create db, create tables", &opts["sqlite-db-create"], + "sqlite-db-drop", "--sqlite-db-drop drop tables & db", &opts["sqlite-db-drop"], + "sqlite-db-recreate", "--sqlite-db-recreate create db, create tables", &opts["sqlite-db-recreate"], + "sqlite-delete", "--sqlite process sqlite output", &opts["sqlite-delete"], + "sqlite-insert", "--sqlite process sqlite output", &opts["sqlite-insert"], "sqlite-update", "--sqlite process sqlite output", &opts["sqlite-update"], "text", "--text process text output", &opts["text"], "txt", "--txt process text output", &opts["text"], @@ -142,6 +149,7 @@ void main(string[] args) { "skip-output", "--skip-output", &opts["skip-output"], "output-dir", "--output-dir=[dir path]", &settings["output-dir"], "site-config-dir", "--site-config-dir=[dir path]", &settings["site-config-dir"], + "sqlite-filename", "--sqlite-filename=[filename].sqlite", &settings["sqlite-filename"], "lang", "--lang=[lang code e.g. =en or =en,es]", &settings["lang"], ); if (helpInfo.helpWanted) { @@ -224,14 +232,34 @@ void main(string[] args) { auto sqlite_discrete() { return opts["sqlite-discrete"]; } - auto sqlite_update() { - return opts["sqlite-update"]; + auto sqlite_db_drop() { + bool _is; + if ( + opts["sqlite-db-recreate"] + || opts["sqlite-db-drop"] + ) { + _is = true; + } else { _is = false; } + return _is; } - auto sqlite_create() { - return opts["sqlite-create"]; + auto sqlite_db_create() { + bool _is; + if ( + opts["sqlite-db-recreate"] + || opts["sqlite-db-create"] + ) { + _is = true; + } else { _is = false; } + return _is; + } + auto sqlite_insert() { + return opts["sqlite-insert"]; + } + auto sqlite_delete() { + return opts["sqlite-delete"]; } - auto sqlite_drop() { - return opts["sqlite-drop"]; + auto sqlite_update() { + return opts["sqlite-update"]; } auto text() { return opts["text"]; @@ -281,6 +309,9 @@ void main(string[] args) { auto output_dir_set() { return settings["output-dir"]; } + auto sqlite_filename() { + return settings["sqlite-filename"]; + } auto abstraction() { bool _is; if ( @@ -297,6 +328,8 @@ void main(string[] args) { || sisupod || source || sqlite_discrete + || sqlite_delete + || sqlite_insert || sqlite_update || text || xhtml @@ -336,10 +369,8 @@ void main(string[] args) { if (exists(sisudoc_txt_)) { contents_location_raw_ = sisudoc_txt_.readText; } - } - catch (ErrnoException ex) { - } - catch (FileException ex) { + } catch (ErrnoException ex) { + } catch (FileException ex) { // Handle errors } if (contents_location_raw_.match(rgx.pod_content_location)) { // (file name followed by language codes \n)+ @@ -369,14 +400,15 @@ void main(string[] args) { ) { auto _fns = (((tmp_dir_).chainPath(contents_location_pth_)).array).to!string; _manifest_matter = PathMatters!()(_opt_action, _env, arg, _fns, contents_locations_arr); - _manifests ~= _manifest_matter; // TODO how to capture? + _manifests ~= _manifest_matter; } } } else if (arg.match(rgx.src_pth_sst_or_ssm)) { if (exists(arg)==0) { writeln("ERROR >> Processing Skipped! File not found: ", arg); } else { - _manifests ~= PathMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing + _manifest_matter = PathMatters!()(_opt_action, _env, arg, arg); + _manifests ~= _manifest_matter; } } else if (arg.match(rgx.src_pth_zip)) { // fns_src ~= arg; // gather input markup source file names for processing -- cgit v1.2.3