From 6010b9f091231d6cfb4fb28ee0a3cb750dc5d2cd Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 9 Feb 2023 00:41:48 -0500 Subject: [PATCH] bin/xbps-uhelper: add longopts for -CdrV also adjust help output to be more clear, and removed examples (moving those to the manpage) --- bin/xbps-uhelper/main.c | 50 ++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/bin/xbps-uhelper/main.c b/bin/xbps-uhelper/main.c index d0ff44e5..3a5a64b8 100644 --- a/bin/xbps-uhelper/main.c +++ b/bin/xbps-uhelper/main.c @@ -44,40 +44,30 @@ usage(void) "usage: xbps-uhelper [options] [action] [args]\n" "\n" " Available actions:\n" - " binpkgarch, binpkgver, cmpver, fetch, getpkgdepname,\n" + " binpkgarch, binpkgver, cmpver, getpkgdepname,\n" " getpkgname, getpkgrevision, getpkgversion, pkgmatch, version,\n" " real-version, arch, getsystemdir, getname, getversion\n" "\n" " Action arguments:\n" - " binpkgarch\t ...\n" - " binpkgver\t ...\n" - " cmpver\t\t \n" - " getpkgdepname\t ...\n" - " getpkgdepversion\t ...\n" - " getpkgname\t\t ...\n" - " getpkgrevision\t ...\n" - " getpkgversion\t ...\n" - " getname\t\t ...\n" - " getversion\t\t ...\n" - " pkgmatch\t\t \n" - " version\t\t ...\n" - " real-version\t ...\n" + " binpkgarch ...\n" + " binpkgver ...\n" + " cmpver \n" + " getpkgdepname ...\n" + " getpkgdepversion ...\n" + " getpkgname ...\n" + " getpkgrevision ...\n" + " getpkgversion ...\n" + " getname ...\n" + " getversion ...\n" + " pkgmatch \n" + " version ...\n" + " real-version ...\n" "\n" " Options shared by all actions:\n" - " -C\t\tPath to xbps.conf file.\n" - " -d\t\tDebugging messages to stderr.\n" - " -r\t\t\n" - " -V\t\tPrints the xbps release version\n" - "\n" - " Examples:\n" - " $ xbps-uhelper cmpver 'foo-1.0_1' 'foo-2.1_1'\n" - " $ xbps-uhelper getpkgdepname 'foo>=0'\n" - " $ xbps-uhelper getpkgdepversion 'foo>=0'\n" - " $ xbps-uhelper getpkgname foo-2.0_1\n" - " $ xbps-uhelper getpkgrevision foo-2.0_1\n" - " $ xbps-uhelper getpkgversion foo-2.0_1\n" - " $ xbps-uhelper pkgmatch foo-1.0_1 'foo>=1.0'\n" - " $ xbps-uhelper version pkgname\n"); + " -C, --config Path to xbps.conf file.\n" + " -d, --debug Debugging messages to stderr.\n" + " -r, --rootdir \n" + " -V, --version Prints the xbps release version\n"); exit(EXIT_FAILURE); } @@ -107,6 +97,10 @@ main(int argc, char **argv) char pkgname[XBPS_NAME_SIZE], *filename; int flags = 0, c, rv = 0, i = 0; const struct option longopts[] = { + { "config", required_argument, NULL, 'C' }, + { "debug", no_argument, NULL, 'd' }, + { "rootdir", required_argument, NULL, 'r' }, + { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } };