aboutsummaryrefslogtreecommitdiff
path: root/share/aux/cases/cp_if
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-03 20:26:50 -0300
committerEuAndreh <eu@euandre.org>2023-04-03 20:26:50 -0300
commit2aac6c3946670cacd254f8f7a68249e831771f5f (patch)
tree8fc46b9b94a07a3fc437b29662e313c15a1e18f4 /share/aux/cases/cp_if
parentbin/aux: Build repository db from filesystem instead of variable in the program (diff)
downloaddotfiles-2aac6c3946670cacd254f8f7a68249e831771f5f.tar.gz
dotfiles-2aac6c3946670cacd254f8f7a68249e831771f5f.tar.xz
share/aux/: Update aux db for new declarative format
Diffstat (limited to 'share/aux/cases/cp_if')
-rwxr-xr-xshare/aux/cases/cp_if/aux/po4a-cfg.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/share/aux/cases/cp_if/aux/po4a-cfg.sh b/share/aux/cases/cp_if/aux/po4a-cfg.sh
new file mode 100755
index 0000000..11e51aa
--- /dev/null
+++ b/share/aux/cases/cp_if/aux/po4a-cfg.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ FIXME
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+ FIXME
+ EOF
+}
+
+
+for flag in "$@"; do
+ case "$flag" in
+ --)
+ break
+ ;;
+ --help)
+ usage
+ help
+ exit
+ ;;
+ *)
+ ;;
+ esac
+done
+
+while getopts 'f:L:h' flag; do
+ case "$flag" in
+ f)
+ FILES="$OPTARG"
+ ;;
+ h)
+ usage
+ help
+ exit
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+. aux/lib.sh
+
+
+files() {
+ printf '%s' "${FILES:-}" | tr ' ' '\n' | grep .
+}
+
+guess_type() {
+ case "$1" in
+ *.md)
+ echo text
+ ;;
+ *.[1-9]*.in)
+ echo man
+ ;;
+ *)
+ echo text
+ ;;
+ esac
+}
+
+
+cat <<-'EOF'
+ [options] --keep 0 --master-charset UTF-8 --localized-charset UTF-8
+
+ [po_directory] po
+
+EOF
+
+files | while read -r file; do
+ TYPE="$(guess_type "$file")"
+ # shellcheck disable=2016
+ VAR_FILE="$(printf '%s' "$file" | sed 's|\.en\.|.$lang.|')"
+ # shellcheck disable=2016
+ printf '[type: %s] %s $lang:%s\n' "$TYPE" "$file" "$VAR_FILE"
+done