aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--org/spine.org21
-rw-r--r--org/tests_for_document_abstraction_shell_scripts.org4
-rw-r--r--src/sisudoc/spine.d21
-rwxr-xr-xtest/test-abstraction-db-roundtrip.sh4
4 files changed, 34 insertions, 16 deletions
diff --git a/org/spine.org b/org/spine.org
index a0f0570..7c62cd0 100644
--- a/org/spine.org
+++ b/org/spine.org
@@ -350,6 +350,7 @@ string program_name = "spine";
#+NAME: imports_spine
#+BEGIN_SRC d
import std.algorithm;
+import std.array;
import std.datetime;
import std.getopt;
import std.file;
@@ -630,7 +631,7 @@ string[string] settings = [
"output" : "",
"pod-compression" : "",
"ssp-round-trip" : "",
- "db-round-trip" : "",
+ "ocda-db-round-trip" : "",
"ocda-verify" : "",
"abstraction-source" : "",
"www-http" : "",
@@ -661,7 +662,10 @@ string[string] settings = [
auto helpInfo = getopt(args,
std.getopt.config.passThrough,
"abstraction", "document abstraction", &opts["abstraction"],
- "abstraction-db", "document abstraction (write ocda.db sqlite file)", &opts["abstraction-db"],
+ /+ ↓ undocumented alias of --ocda-db, which names the artefact it writes
+ kept working but filtered out of help listing
+ +/
+ "abstraction-db", "", &opts["abstraction-db"],
"allow-downloads", "allow a url argument to be fetched (zip or db)", &opts["allow-downloads"],
"assert", "set optional assertions on", &opts["assertions"],
"cgi-bin-root", "path to cgi-bin directory", &settings["cgi-bin-root"],
@@ -702,7 +706,7 @@ auto helpInfo = getopt(args,
"odt", "open document format text", &opts["odt"],
"output", "=/path/to/output/dir specify where to place output", &settings["output"],
"ssp-round-trip", "=/path/to/file.ssp read a .ssp back and re-emit it on stdout", &settings["ssp-round-trip"],
- "db-round-trip", "=/path/to/file.ocda.db read it back and emit .ssp on stdout", &settings["db-round-trip"],
+ "ocda-db-round-trip", "=/path/to/file.ocda.db read it back and emit .ssp on stdout", &settings["ocda-db-round-trip"],
"ocda-verify", "=/path/to/file.ocda.db does this spine still make this abstraction from the markup it carries", &settings["ocda-verify"],
"no-verify", "do not check carried markup against the abstraction it was built with", &opts["no-verify"],
"abstraction-source", "=/path/to/(.sst|pod|.ssp|.ocda.db) identify it, and load it if it is an abstraction", &settings["abstraction-source"],
@@ -795,6 +799,11 @@ if (opts["po4a-cfg"]) {
#+NAME: spine_args_get_help
#+BEGIN_SRC d
if (helpInfo.helpWanted) {
+ /+ ↓ the undocumented alias is registered so that it still works, and is
+ not listed, so that --ocda-db is the one flag the help offers
+ +/
+ auto _options_documented
+ = helpInfo.options.filter!(o => o.optLong != "--abstraction-db").array;
defaultGetoptPrinter(
"spine: structure, parse, publish and search document collections.\n"
~ "\n"
@@ -809,7 +818,7 @@ if (opts["po4a-cfg"]) {
~ " <doc>.ocda.db the abstraction, as sqlite\n"
~ "\n"
~ "A url is fetched only with --allow-downloads.\n",
- helpInfo.options
+ _options_documented
);
/+ ↓ the contract, after the options: what an artefact carries and what
can be done with it. It belongs in --help because it is the answer
@@ -922,7 +931,7 @@ if (settings["ssp-round-trip"].length > 0) {
.ssp on stdout. compared against the .ssp for the same document, this
says whether the two artefacts really do carry the same thing
+/
-if (settings["db-round-trip"].length > 0) {
+if (settings["ocda-db-round-trip"].length > 0) {
import sisudoc.ocda.abstraction.ssp;
import sisudoc.ocda.abstraction.db_in;
mixin spineAbstractionDbRead;
@@ -941,7 +950,7 @@ if (settings["db-round-trip"].length > 0) {
_rt_lang = _langs[0];
}
}
- auto _doc = dbReadFile(settings["db-round-trip"], _rt_lang);
+ auto _doc = dbReadFile(settings["ocda-db-round-trip"], _rt_lang);
if (_doc.format.length == 0 && _doc.section_order.length == 0) {
import core.stdc.stdlib : exit;
stdout.flush;
diff --git a/org/tests_for_document_abstraction_shell_scripts.org b/org/tests_for_document_abstraction_shell_scripts.org
index d9cccf6..59c5056 100644
--- a/org/tests_for_document_abstraction_shell_scripts.org
+++ b/org/tests_for_document_abstraction_shell_scripts.org
@@ -1074,7 +1074,7 @@ for db in "$OUT_DIR"/pod/*.ocda.db; do
FAILURES=$((FAILURES + 1))
continue
fi
- if ! $SPINE_BIN --db-round-trip="$db" --lang="$lang" \
+ if ! $SPINE_BIN --ocda-db-round-trip="$db" --lang="$lang" \
> "$OUT_DIR/from-db.ssp" 2> "$OUT_DIR/from-db.err"; then
echo "ERROR: $base (spine exited non-zero)"
head -3 "$OUT_DIR/from-db.err"
@@ -1090,7 +1090,7 @@ for db in "$OUT_DIR"/pod/*.ocda.db; do
done
# more than one language and none named: it must refuse rather than pick
if [ "$n_langs" -gt 1 ]; then
- if $SPINE_BIN --db-round-trip="$db" > /dev/null 2> /dev/null; then
+ if $SPINE_BIN --ocda-db-round-trip="$db" > /dev/null 2> /dev/null; then
echo "$stem"
echo " ACCEPTED a round trip with no language named, holding $n_langs"
FAILURES=$((FAILURES + 1))
diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d
index c1a3f63..0494a34 100644
--- a/src/sisudoc/spine.d
+++ b/src/sisudoc/spine.d
@@ -55,6 +55,7 @@ homepage "https://sisudoc.org"
+/
@safe:
import std.algorithm;
+import std.array;
import std.datetime;
import std.getopt;
import std.file;
@@ -231,7 +232,7 @@ string program_name = "spine";
"output" : "",
"pod-compression" : "",
"ssp-round-trip" : "",
- "db-round-trip" : "",
+ "ocda-db-round-trip" : "",
"ocda-verify" : "",
"abstraction-source" : "",
"www-http" : "",
@@ -256,7 +257,10 @@ string program_name = "spine";
auto helpInfo = getopt(args,
std.getopt.config.passThrough,
"abstraction", "document abstraction", &opts["abstraction"],
- "abstraction-db", "document abstraction (write ocda.db sqlite file)", &opts["abstraction-db"],
+ /+ ↓ undocumented alias of --ocda-db, which names the artefact it writes
+ kept working but filtered out of help listing
+ +/
+ "abstraction-db", "", &opts["abstraction-db"],
"allow-downloads", "allow a url argument to be fetched (zip or db)", &opts["allow-downloads"],
"assert", "set optional assertions on", &opts["assertions"],
"cgi-bin-root", "path to cgi-bin directory", &settings["cgi-bin-root"],
@@ -297,7 +301,7 @@ string program_name = "spine";
"odt", "open document format text", &opts["odt"],
"output", "=/path/to/output/dir specify where to place output", &settings["output"],
"ssp-round-trip", "=/path/to/file.ssp read a .ssp back and re-emit it on stdout", &settings["ssp-round-trip"],
- "db-round-trip", "=/path/to/file.ocda.db read it back and emit .ssp on stdout", &settings["db-round-trip"],
+ "ocda-db-round-trip", "=/path/to/file.ocda.db read it back and emit .ssp on stdout", &settings["ocda-db-round-trip"],
"ocda-verify", "=/path/to/file.ocda.db does this spine still make this abstraction from the markup it carries", &settings["ocda-verify"],
"no-verify", "do not check carried markup against the abstraction it was built with", &opts["no-verify"],
"abstraction-source", "=/path/to/(.sst|pod|.ssp|.ocda.db) identify it, and load it if it is an abstraction", &settings["abstraction-source"],
@@ -384,6 +388,11 @@ string program_name = "spine";
_run_banner = false;
}
if (helpInfo.helpWanted) {
+ /+ ↓ the undocumented alias is registered so that it still works, and is
+ not listed, so that --ocda-db is the one flag the help offers
+ +/
+ auto _options_documented
+ = helpInfo.options.filter!(o => o.optLong != "--abstraction-db").array;
defaultGetoptPrinter(
"spine: structure, parse, publish and search document collections.\n"
~ "\n"
@@ -398,7 +407,7 @@ string program_name = "spine";
~ " <doc>.ocda.db the abstraction, as sqlite\n"
~ "\n"
~ "A url is fetched only with --allow-downloads.\n",
- helpInfo.options
+ _options_documented
);
/+ ↓ the contract, after the options: what an artefact carries and what
can be done with it. It belongs in --help because it is the answer
@@ -498,7 +507,7 @@ Verifying:
.ssp on stdout. compared against the .ssp for the same document, this
says whether the two artefacts really do carry the same thing
+/
- if (settings["db-round-trip"].length > 0) {
+ if (settings["ocda-db-round-trip"].length > 0) {
import sisudoc.ocda.abstraction.ssp;
import sisudoc.ocda.abstraction.db_in;
mixin spineAbstractionDbRead;
@@ -517,7 +526,7 @@ Verifying:
_rt_lang = _langs[0];
}
}
- auto _doc = dbReadFile(settings["db-round-trip"], _rt_lang);
+ auto _doc = dbReadFile(settings["ocda-db-round-trip"], _rt_lang);
if (_doc.format.length == 0 && _doc.section_order.length == 0) {
import core.stdc.stdlib : exit;
stdout.flush;
diff --git a/test/test-abstraction-db-roundtrip.sh b/test/test-abstraction-db-roundtrip.sh
index 0ec7847..698eb22 100755
--- a/test/test-abstraction-db-roundtrip.sh
+++ b/test/test-abstraction-db-roundtrip.sh
@@ -100,7 +100,7 @@ for db in "$OUT_DIR"/pod/*.ocda.db; do
FAILURES=$((FAILURES + 1))
continue
fi
- if ! $SPINE_BIN --db-round-trip="$db" --lang="$lang" \
+ if ! $SPINE_BIN --ocda-db-round-trip="$db" --lang="$lang" \
> "$OUT_DIR/from-db.ssp" 2> "$OUT_DIR/from-db.err"; then
echo "ERROR: $base (spine exited non-zero)"
head -3 "$OUT_DIR/from-db.err"
@@ -116,7 +116,7 @@ for db in "$OUT_DIR"/pod/*.ocda.db; do
done
# more than one language and none named: it must refuse rather than pick
if [ "$n_langs" -gt 1 ]; then
- if $SPINE_BIN --db-round-trip="$db" > /dev/null 2> /dev/null; then
+ if $SPINE_BIN --ocda-db-round-trip="$db" > /dev/null 2> /dev/null; then
echo "$stem"
echo " ACCEPTED a round trip with no language named, holding $n_langs"
FAILURES=$((FAILURES + 1))