From cb6eb5fa33cbab8a30635ffdbaed853ea82d3962 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 4 Apr 2023 06:48:15 -0300 Subject: share/aux/cases/*/aux/{ci/report.sh,po4a-cfg}.sh: Update and improve help string --- share/aux/cases/cp_all/aux/ci/report.sh | 34 +++++++++++++++++---------------- share/aux/cases/cp_if/aux/po4a-cfg.sh | 32 +++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 18 deletions(-) (limited to 'share/aux/cases') diff --git a/share/aux/cases/cp_all/aux/ci/report.sh b/share/aux/cases/cp_all/aux/ci/report.sh index 2f36ad5..0a0a0ae 100755 --- a/share/aux/cases/cp_all/aux/ci/report.sh +++ b/share/aux/cases/cp_all/aux/ci/report.sh @@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - aux/ci/report.sh -n NAME -o OUTDIR + aux/ci/report.sh -o OUTDIR aux/ci/report.sh -h EOF } @@ -14,7 +14,6 @@ help() { Options: - -n NAME the name of the project -o OUTDIR the directory where to place the generated files -h, --help show this message @@ -31,23 +30,30 @@ help() { from refs/notes/ci-logs. On a CI run that generated the numbers from 1 to 10, for a file named - 'my-ci-run-2020-01-01-deadbeef.log' that exited successfully, the - expected output on the target directory "public" is: + 'my-ci-run-2020-01-01-deadbeef.log' that exited successfully, ran for + 15 seconds and was deployed to production, the expected output on the + target directory "public" is: $ tree public/ public/ index.html data/ - my-ci-run-2020-01-01-deadbeef.log + 2020-01-01T01:00:00-deadbeef.log ... logs/ - my-ci-run-2020-01-01-deadbeef.log + 2020-01-01T01:00:00-deadbeef.log ... - $ cat public/data/my-ci-run-2020-01-01-deadbeef.log - 0 deadbeef my-ci-run-2020-01-01-deadbeef.log + $ cat public/data/2020-01-01T01:00:00-deadbeef.log + status 0 + sha deadbeef + filename deadbeef 2020-01-01T01:00:00-deadbeef.log + duration 15 + timestamp 2020-01-01T01:00:00 + to-prod true + refname refs/heads/main - $ cat public/logs/my-ci-run-2020-01-01-deadbeef.log + $ cat public/logs/2020-01-01T01:00:00-deadbeef.log 1 2 3 @@ -61,7 +67,7 @@ help() { The generated 'index.html' is a webpage with the list of all known CI runs, their status, a link to the commit and a link to the - log file. + log and data files. To enable fetching these refs by default, do so in the git config: @@ -72,7 +78,7 @@ help() { Generate the report on the 'www' directory: - $ report -o www + $ sh aux/ci/report.sh -o www EOF } @@ -92,11 +98,8 @@ for flag in "$@"; do esac done -while getopts 'n:o:h' flag; do +while getopts 'o:h' flag; do case "$flag" in - n) - NAME="$OPTARG" - ;; o) OUTDIR="$OPTARG" ;; @@ -114,7 +117,6 @@ shift $((OPTIND - 1)) . aux/lib.sh -eval "$(assert_arg "${NAME:-}" '-n NAME')" eval "$(assert_arg "${OUTDIR:-}" '-o OUTDIR')" diff --git a/share/aux/cases/cp_if/aux/po4a-cfg.sh b/share/aux/cases/cp_if/aux/po4a-cfg.sh index 11e51aa..7813f28 100755 --- a/share/aux/cases/cp_if/aux/po4a-cfg.sh +++ b/share/aux/cases/cp_if/aux/po4a-cfg.sh @@ -3,13 +3,41 @@ set -eu usage() { cat <<-'EOF' - FIXME + Usage: + aux/po4a-cfg.sh > po/po4a.cfg + aux/po4a-cfg.sh -h EOF } help() { cat <<-'EOF' - FIXME + + + Options: + -h, --help show this message + + + Discover translatable files in the repository (via + git-ls-files(1)) that have '.en.' or '/en/' in their name and + emit the configuration file to be used with po4a(1). + + + Examples: + + Setup i18n on a new repository: + + $ mkdir po + $ touch po/pt.po + $ touch po/"$(basename "$PWD")".pot + $ aux/po4a-cfg.sh > po/po4a.cfg + $ po4a po/po4a.cfg + + + Conditionally update the configuration in a Makefile: + + po/po4a.cfg: ALWAYS + @sh aux/po4a-cfg.sh | ifnew $@ + po4a $@ EOF } -- cgit v1.2.3