[pacman-dev] [PATCH 10/11] rankmirrors: streamline usage function

Gordian Edenhofer gordian.edenhofer at gmail.com
Thu Sep 29 10:23:10 UTC 2016


Signed-off-by: Gordian Edenhofer <gordian.edenhofer at gmail.com>
---
 contrib/rankmirrors.sh.in | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/contrib/rankmirrors.sh.in b/contrib/rankmirrors.sh.in
index 7b50eb2..6ded91f 100644
--- a/contrib/rankmirrors.sh.in
+++ b/contrib/rankmirrors.sh.in
@@ -25,22 +25,24 @@ declare -r myname='rankmirrors'
 declare -r myver='@PACKAGE_VERSION@'
 
 usage() {
-	echo "${myname} (pacman) v${myver}"
+	printf "%s (pacman) %s\n" "$myname" "$myver"
 	echo
-	echo "Ranks pacman mirrors by their connection and opening speed. Pacman mirror"
-	echo "files are located in @sysconfdir@/pacman.d/. It can also rank one mirror if the URL is"
-	echo "provided."
+	printf -- "$(gettext "\
+Ranks pacman mirrors by their connection and opening speed. Pacman mirror\n\
+files are located in @sysconfdir@/pacman.d/. It can also rank one mirror if the URL is\n\
+provided")\n"
 	echo
-	echo "Usage: ${myname} [options] MIRRORFILE | URL"
+	printf -- "$(gettext "Usage: %s [options] <mirrorfile|URL>")\n" "$0"
+	echo
+	printf -- "$(gettext "Options:")\n"
+	printf -- "$(gettext "  -h, --help         Show this help message and exit")\n"
+	printf -- "$(gettext "  -n <N>             Number of servers to output, 0 for all")\n"
+	printf -- "$(gettext "  -t, --times        Only output mirrors and their response times")\n"
+	printf -- "$(gettext "  -u, --url          Test a specific URL")\n"
+	printf -- "$(gettext "  -v, --verbose      Be verbose in ouptut")\n"
+	printf -- "$(gettext "  -r, --repo <repo>  Specify a repository name instead of guessing")\n"
+	printf -- "$(gettext "  --version          Show program's version number and exit")\n"
 	echo
-	echo "Options:"
-	echo "  --version      show program's version number and exit"
-	echo "  -h, --help     show this help message and exit"
-	echo "  -n NUM         number of servers to output, 0 for all"
-	echo "  -t, --times    only output mirrors and their response times"
-	echo "  -u, --url      test a specific URL"
-	echo "  -v, --verbose  be verbose in ouptut"
-	echo "  -r, --repo     specify a repository name instead of guessing"
 	exit 0
 }
 
-- 
2.10.0


More information about the pacman-dev mailing list