diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2019-09-02 18:57:43 +0200 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2019-09-02 18:57:43 +0200 |
commit | 7b46c372149e7aca36cdb98fc8158ed04daf973d (patch) | |
tree | 2df331104d24fcc76c82d0da4b028d991c784daa /dist-tools | |
parent | 4146f3c07e2c947ba5fe5756fb8114b9c81659d5 (diff) | |
download | fetchmail-7b46c372149e7aca36cdb98fc8158ed04daf973d.tar.gz fetchmail-7b46c372149e7aca36cdb98fc8158ed04daf973d.tar.bz2 fetchmail-7b46c372149e7aca36cdb98fc8158ed04daf973d.zip |
dist-tools/git-commit-po-updates.sh updates
- add copyright notice and license
- add a terse documentation as header
- add an option -n (dry-run) that only prints what would be done.
Diffstat (limited to 'dist-tools')
-rwxr-xr-x | dist-tools/git-commit-po-updates.sh | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/dist-tools/git-commit-po-updates.sh b/dist-tools/git-commit-po-updates.sh index 1c2079fe..13e2bf5c 100755 --- a/dist-tools/git-commit-po-updates.sh +++ b/dist-tools/git-commit-po-updates.sh @@ -1,9 +1,33 @@ #!/bin/sh +# dist-tools/git-commit-po-updates.sh +# A helper script to commit translation updates into Git. +# Assumes translation updates are visible to git, +# and one directory above. +# +# © Copyright 2019 by Matthias Andree. +# Licensed under the GNU General Public License V2 or, +# at your choice, any later version. +# +# Supported options: +# -n: dry-run, only print commands, but do not run them. set -eu -# see if Perl has Carp::Always available: + +cd "$(realpath $(dirname $0))/.." + +# see if Perl has Carp::Always available, +# and implicitly fail (set -e) if it hasn't. perl -MCarp::Always -e '' +dryrun_pfx= +while getopts 'n' opt ; do + case $opt in + n) dryrun_pfx=: ;; + ?) printf 'Usage: %s [-n]\n' "$0" ; + exit 2 ; + esac +done + git diff -G ^.Project-Id-Version --name-only po/*.po \ | while read pofile ; do if ! cmd="$(perl -WT - "$pofile" <<'_EOF' @@ -39,5 +63,5 @@ _EOF fi cmd="$cmd '$pofile'" printf '+ %s\n' "$cmd" - eval "$cmd" + $dryrun_pfx eval "$cmd" done |