summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJason St. John <jstjohn@purdue.edu>2013-09-03 21:20:50 +0200
committerAllan McRae <allan@archlinux.org>2013-09-04 01:51:20 +0200
commita86015f73fdda878287a2ad21011594862bf506a (patch)
tree61a580ebc898312361abe79f5bfa99441698ddec /src/util
parent4245c6b222703dda7bd6000e180c777f480e4420 (diff)
downloadpacman-a86015f73fdda878287a2ad21011594862bf506a.tar.gz
pacman-a86015f73fdda878287a2ad21011594862bf506a.tar.xz
Improve --help switch output for pacman utils
Unify the formatting of the --help switch for pacman utils, if it exists. All of the pacman utils will now output help text using the following format: util-name (pacman) v<pacman version> one line description of util's purpose Usage: util-name [options] -b, --bar whatever --bar does -f, --foo whatever --foo does -h, --help display this help message The --help switch does not exist for a couple of the utils, so the help/usage text for those will be displayed when the util is run with no arguments. Reported-by: Karol Błażewicz <karol.blazewicz at gmail.com> Signed-off-by: Jason St. John <jstjohn@purdue.edu> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/cleanupdelta.c9
-rw-r--r--src/util/pacsort.c5
-rw-r--r--src/util/pactree.c7
-rw-r--r--src/util/testdb.c12
-rw-r--r--src/util/testpkg.c6
-rw-r--r--src/util/vercmp.c17
6 files changed, 28 insertions, 28 deletions
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index 4f344350..b13d770b 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -24,8 +24,6 @@
#include <alpm.h>
#include <alpm_list.h>
-#define BASENAME "cleanupdelta"
-
alpm_handle_t *handle = NULL;
static void cleanup(int signum)
@@ -87,9 +85,10 @@ static void checkdbs(alpm_list_t *dbnames)
static void usage(void)
{
- fprintf(stderr, "usage:\n");
- fprintf(stderr,
- "\t%s [-b <pacman db>] core extra ... : check the listed sync databases\n", BASENAME);
+ fprintf(stderr, "cleanupdelta (pacman) v" PACKAGE_VERSION "\n\n"
+ "Returns a list of unused delta in a given sync database.\n\n"
+ "Usage: cleanupdelta [options]\n\n"
+ " -b <pacman db> core extra ... : check the listed sync databases\n");
exit(1);
}
diff --git a/src/util/pacsort.c b/src/util/pacsort.c
index 7c551c2b..687e558d 100644
--- a/src/util/pacsort.c
+++ b/src/util/pacsort.c
@@ -343,9 +343,10 @@ static char escape_char(const char *string)
static void usage(void)
{
- fprintf(stderr, "pacsort v" PACKAGE_VERSION "\n"
+ fprintf(stderr, "pacsort (pacman) v" PACKAGE_VERSION "\n\n"
+ "A sort utility implementing alpm_pkg_vercmp.\n\n"
"Usage: pacsort [options] [files...]\n\n"
- " -f, --files assume inputs are filepaths of packages\n"
+ " -f, --files assume inputs are file paths of packages\n"
" -h, --help display this help message\n"
" -k, --key <index> sort input starting on specified column\n"
" -r, --reverse sort in reverse order (default: oldest to newest)\n"
diff --git a/src/util/pactree.c b/src/util/pactree.c
index 42c75aaf..3d55d9f1 100644
--- a/src/util/pactree.c
+++ b/src/util/pactree.c
@@ -310,9 +310,10 @@ static int parse_options(int argc, char *argv[])
static void usage(void)
{
- fprintf(stderr, "pactree v" PACKAGE_VERSION "\n"
+ fprintf(stderr, "pactree (pacman) v" PACKAGE_VERSION "\n\n"
+ "A simple dependency tree viewer.\n\n"
"Usage: pactree [options] PACKAGE\n\n"
- " -a, --ascii use ascii characters for tree formatting\n"
+ " -a, --ascii use ASCII characters for tree formatting\n"
" -b, --dbpath <path> set an alternate database location\n"
" -c, --color colorize output\n"
" -d, --depth <#> limit the depth of recursion\n"
@@ -320,7 +321,7 @@ static void usage(void)
" -h, --help display this help message\n"
" -l, --linear enable linear output\n"
" -r, --reverse list packages that depend on the named package\n"
- " -s, --sync search sync DBs instead of local\n"
+ " -s, --sync search sync databases instead of local\n"
" -u, --unique show dependencies with no duplicates (implies -l)\n"
" --config <path> set an alternate configuration file\n");
}
diff --git a/src/util/testdb.c b/src/util/testdb.c
index 0ca7ffc8..3d341b35 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -27,8 +27,6 @@
#include <alpm.h>
#include <alpm_list.h>
-#define BASENAME "testdb"
-
alpm_handle_t *handle = NULL;
static void cleanup(int signum)
@@ -244,11 +242,11 @@ cleanup:
static void usage(void)
{
- fprintf(stderr, "usage:\n");
- fprintf(stderr,
- "\t%s [-b <pacman db>] : check the local database\n", BASENAME);
- fprintf(stderr,
- "\t%s [-b <pacman db>] core extra ... : check the listed sync databases\n", BASENAME);
+ fprintf(stderr, "testdb (pacman) v" PACKAGE_VERSION "\n\n"
+ "Test a pacman local database for validity.\n\n"
+ "Usage: testdb [options]\n\n"
+ " -b <pacman db> : check the local database\n"
+ " -b <pacman db> core extra ... : check the listed sync databases\n");
exit(1);
}
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index 10b2f2c2..d1b75ac5 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -22,8 +22,6 @@
#include <alpm.h>
-#define BASENAME "testpkg"
-
__attribute__((format(printf, 2, 0)))
static void output_cb(alpm_loglevel_t level, const char *fmt, va_list args)
{
@@ -47,7 +45,9 @@ int main(int argc, char *argv[])
const alpm_siglevel_t level = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL;
if(argc != 2) {
- fprintf(stderr, "usage: %s <package file>\n", BASENAME);
+ fprintf(stderr, "testpkg (pacman) v" PACKAGE_VERSION "\n\n"
+ "Test a pacman package for validity.\n\n"
+ "Usage: testpkg <package file>\n");
return 1;
}
diff --git a/src/util/vercmp.c b/src/util/vercmp.c
index f4356fb4..41a4f8e2 100644
--- a/src/util/vercmp.c
+++ b/src/util/vercmp.c
@@ -1,5 +1,6 @@
/*
- * vercmp.c
+ * vercmp.c - Compare package version numbers using pacman's version
+ * comparison logic
*
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org>
@@ -22,19 +23,19 @@
#include <stdio.h> /* printf */
#include <string.h>
-#define BASENAME "vercmp"
-
/* forward declaration, comes from version.o in libalpm source that is linked
* in directly so we don't have any library deps */
int alpm_pkg_vercmp(const char *a, const char *b);
static void usage(void)
{
- fprintf(stderr, "usage: %s <ver1> <ver2>\n\n", BASENAME);
- fprintf(stderr, "output values:\n");
- fprintf(stderr, " < 0 : if ver1 < ver2\n");
- fprintf(stderr, " 0 : if ver1 == ver2\n");
- fprintf(stderr, " > 0 : if ver1 > ver2\n");
+ fprintf(stderr, "vercmp (pacman) v" PACKAGE_VERSION "\n\n"
+ "Compare package version numbers using pacman's version comparison logic.\n\n"
+ "Usage: vercmp <ver1> <ver2>\n\n"
+ "Output values:\n"
+ " < 0 : if ver1 < ver2\n"
+ " 0 : if ver1 == ver2\n"
+ " > 0 : if ver1 > ver2\n");
}
int main(int argc, char *argv[])