[pacman-dev] [RFC v2 08/13] paclist: streamline usage function

Gordian Edenhofer gordian.edenhofer at gmail.com
Thu Sep 29 12:41:21 UTC 2016


Signed-off-by: Gordian Edenhofer <gordian.edenhofer at gmail.com>
---
 contrib/paclist.sh.in | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/contrib/paclist.sh.in b/contrib/paclist.sh.in
index f4fd540..47589f7 100644
--- a/contrib/paclist.sh.in
+++ b/contrib/paclist.sh.in
@@ -20,24 +20,27 @@
 declare -r myname='paclist'
 declare -r myver='@PACKAGE_VERSION@'
 
+# gettext initialization
 export TEXTDOMAIN='pacman'
-export TEXTDOMAINDIR='/usr/share/locale'
+export TEXTDOMAINDIR='@localedir@'
 
 # determine whether we have gettext; make it a no-op if we do not
-if ! type gettext &>/dev/null; then
+if ! type -p gettext >/dev/null; then
 	gettext() {
-		echo "$@"
+		printf "%s\n" "$@"
 	}
 fi
 
 usage() {
-	printf "%s (pacman) v%s\n" "${myname}" "${myver}"
+	printf "%s (pacman) %s\n" "$myname" "$myver"
 	echo
-	printf "List all packages installed from a given repository\n" "${myname}"
+	printf -- "$(gettext "List all packages installed from a given repository")\n"
 	echo
-	printf "Usage: %s <repository>\n" "${myname}"
+	printf -- "$(gettext "Usage: %s <repository>")\n" "$0"
+	echo
+	printf -- "$(gettext "Examples:")"
+	printf -- "    %s testing\n" "$myname"
 	echo
-	printf "Example: %s testing\n" "${myname}"
 }
 
 version() {
-- 
2.10.0


More information about the pacman-dev mailing list