[pacman-dev] [RFC v3 11/13] updpkgsums: streamline usage function

Gordian Edenhofer gordian.edenhofer at gmail.com
Fri Sep 30 11:47:59 UTC 2016


Signed-off-by: Gordian Edenhofer <gordian.edenhofer at gmail.com>
---
 contrib/updpkgsums.sh.in | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/contrib/updpkgsums.sh.in b/contrib/updpkgsums.sh.in
index c571d29..132c192 100644
--- a/contrib/updpkgsums.sh.in
+++ b/contrib/updpkgsums.sh.in
@@ -22,20 +22,37 @@ shopt -s extglob
 declare -r myname='updpkgsums'
 declare -r myver='@PACKAGE_VERSION@'
 
+# gettext initialization
+export TEXTDOMAIN='pacman'
+export TEXTDOMAINDIR='@localedir@'
+
+# Determine whether we have gettext; make it a no-op if we do not
+if ! type -p gettext >/dev/null; then
+	gettext() {
+		printf "%s\n" "$@"
+	}
+fi
+
 usage() {
-	printf "%s (pacman) v%s\n" "${myname}" "${myver}"
+	printf "%s (pacman) %s\n" "$myname" "$myver"
+	echo
+	printf -- "$(gettext "\
+%s will perform an in place update of the checksums in the\n\
+path specified by [build file], defaulting to PKGBUILD in the current\n\
+working directory")\n" "$myname"
 	echo
-	printf "%s will perform an in place update of the checksums in the\n" "${myname}"
-	echo "path specified by [build file], defaulting to PKGBUILD in the current"
-	echo "working directory."
+	printf -- "$(gettext "Usage: %s [options] [build file]")\n" "$0"
 	echo
-	printf "Usage: %s [options] [build file]\n" "${myname}"
+	printf -- "$(gettext "Options:")\n"
+	printf -- "  -h, --help        "
+	printf -- "$(gettext "Display this help message and exit")\n"
+	printf -- "  -V, --version     "
+	printf -- "$(gettext "Display version information and exit")\n"
 	echo
-	echo "    -h, --help        display this help message and exit"
-	echo "    -V, --version     display version information and exit"
+	printf -- "$(gettext "These options can be passed to makepkg:")\n"
+	printf -- "  -m, --nocolor     "
+	printf -- "$(gettext "Disable colorized output messages")\n"
 	echo
-	echo "These options can be passed to makepkg:"
-	echo "    -m, --nocolor     disable colorized output messages"
 }
 
 version() {
-- 
2.10.0


More information about the pacman-dev mailing list