[pacman-dev] [RFC v2 09/13] paclog-pkglist: streamline usage function
Gordian Edenhofer
gordian.edenhofer at gmail.com
Thu Sep 29 12:41:22 UTC 2016
Signed-off-by: Gordian Edenhofer <gordian.edenhofer at gmail.com>
---
contrib/paclog-pkglist.sh.in | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/contrib/paclog-pkglist.sh.in b/contrib/paclog-pkglist.sh.in
index 847b389..040e183 100644
--- a/contrib/paclog-pkglist.sh.in
+++ b/contrib/paclog-pkglist.sh.in
@@ -20,20 +20,31 @@
declare -r myname='paclog-pkglist'
declare -r myver='@PACKAGE_VERSION@'
-export TEXTDOMAIN='pacman'
-export TEXTDOMAINDIR='/usr/share/locale'
declare logfile=${1:- at localstatedir@/log/pacman.log}
+# 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 "Parse a log file into a list of currently installed packages")\n"
echo
- echo "Parse a log file into a list of currently installed packages"
+ printf -- "$(gettext "Usage: %s [path to pacman log]")\n" "$0"
echo
- printf "Usage: %s [path to pacman log]\n" "${myname}"
+ printf -- "$(gettext "Examples:")"
+ printf -- " %s @localstatedir@/log/pacman.log\n" "$myname"
echo
- printf "Example: %s @localstatedir@/log/pacman.log\n" "${myname}"
+ printf -- "$(gettext "Defaults to: @localstatedir@/log/pacman.log")\n"
echo
- echo 'Defaults to: @localstatedir@/log/pacman.log'
}
version() {
--
2.10.0
More information about the pacman-dev
mailing list