mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 08:18:51 -05:00
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>
This commit is contained in:
parent
4245c6b222
commit
a86015f73f
@ -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);
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,8 @@ 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 file paths of packages\n"
|
||||
" -h, --help display this help message\n"
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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[])
|
||||
|
Loading…
Reference in New Issue
Block a user