diff options
Diffstat (limited to 'pipeline/one.sh')
| -rwxr-xr-x | pipeline/one.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pipeline/one.sh b/pipeline/one.sh new file mode 100755 index 0000000..18ffc5f --- /dev/null +++ b/pipeline/one.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# One tool, one document: the answer to "how do I run this by hand?". +# +# sh pipeline/one.sh <tool> <file> [lang] +# +# where <tool> is one of +# +# ssp-d ssp-g the .ssp readers, D and Gleam +# db-d db-g the .ocda.db readers +# dump-d dump-g the library's canonical dump of the whole model +# agree-d agree-g the library's two loaders against each other +# text-d text-g the writers. Each takes a .ssp, a .ocda.db or a +# md-d md-g .sisupod and is not told which. +# html-d html-g +# epub-d epub-g these two write a file, so they take --out +# typst-d typst-g +# +# and <file> is a .ssp, a .ocda.db or a .sisupod. Output goes to stdout except +# for the epub and the typst, which name a file. +set -e +. "$(dirname "$0")/config.sh" +tool=${1:?usage: one.sh <tool> <file> [lang]} +file=${2:?usage: one.sh <tool> <file> [lang]} +lang=${3:-} + +case $tool in + ssp-d) exec "$SSP_READER/dlang/result/bin/ssp-reader" "$file" ;; + ssp-g) exec "$SSP_READER/gleam/result/bin/ssp_reader" "$file" ;; + db-d) exec "$DB_READER/dlang/result/bin/ocda-db-reader" "$file" ;; + db-g) exec "$DB_READER/gleam/result/bin/ocda-db-reader" "$file" ;; + dump-d) exec "$OCDA_LIB/dlang/result/bin/ocda-dump" "$file" $lang ;; + dump-g) exec "$OCDA_LIB/gleam/result/bin/ocda-lib" dump "$file" $lang ;; + agree-d) exec "$OCDA_LIB/dlang/result/bin/ocda-agree" "$file" $lang ;; + agree-g) exec "$OCDA_LIB/gleam/result/bin/ocda-lib" agree "$file" $lang ;; + *-d) exec "$WRITERS/dlang/result/bin/ocda-write" "--${tool%-d}" "$file" $lang ;; + *-g) exec "$WRITERS/gleam/result/bin/ocda-write" "--${tool%-g}" "$file" $lang ;; + *) echo "one.sh: unknown tool $tool" >&2; exit 2 ;; +esac |
