Rearrange new cli utilities' popt tables for nicer output
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 15 Nov 2010 07:07:10 +0000 (09:07 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 15 Nov 2010 07:07:10 +0000 (09:07 +0200)
- Use a separate table for the tool-specific options, include that from
  the "master" option table to get option group summary in --help.

rpmdb.c
rpmkeys.c
rpmsign.c
rpmspec.c

diff --git a/rpmdb.c b/rpmdb.c
index 173e322..a84862d 100644 (file)
--- a/rpmdb.c
+++ b/rpmdb.c
@@ -17,9 +17,7 @@ enum modes {
 
 static int mode = 0;
 
-static struct poptOption optionsTable[] = {
-    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
-       N_("Common options for all rpm modes and executables:"), NULL },
+static struct poptOption dbOptsTable[] = {
     { "initdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_INITDB,
        N_("initialize database"), NULL},
     { "rebuilddb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_REBUILDDB,
@@ -27,6 +25,14 @@ static struct poptOption optionsTable[] = {
        NULL},
     { "verifydb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_VERIFYDB,
        N_("verify database files"), NULL},
+    POPT_TABLEEND
+};
+
+static struct poptOption optionsTable[] = {
+    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, dbOptsTable, 0,
+       N_("Database options:"), NULL },
+    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
+       N_("Common options for all rpm modes and executables:"), NULL },
 
     POPT_AUTOALIAS
     POPT_AUTOHELP
index 45ca47e..e661899 100644 (file)
--- a/rpmkeys.c
+++ b/rpmkeys.c
@@ -18,9 +18,7 @@ enum modes {
 
 static int mode = 0;
 
-static struct poptOption optionsTable[] = {
-    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
-       N_("Common options for all rpm modes and executables:"), NULL },
+static struct poptOption keyOptsTable[] = {
     { "checksig", 'K', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_CHECKSIG,
        N_("verify package signature(s)"), NULL },
     { "import", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_IMPORTKEY,
@@ -31,6 +29,14 @@ static struct poptOption optionsTable[] = {
     { "list-keys", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_LISTKEY,
        N_("list keys from RPM keyring"), NULL },
 #endif
+    POPT_TABLEEND
+};
+
+static struct poptOption optionsTable[] = {
+    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, keyOptsTable, 0,
+       N_("Keyring options:"), NULL },
+    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
+       N_("Common options for all rpm modes and executables:"), NULL },
 
     POPT_AUTOALIAS
     POPT_AUTOHELP
index a1d749e..c41da4d 100644 (file)
--- a/rpmsign.c
+++ b/rpmsign.c
@@ -20,15 +20,21 @@ enum modes {
 
 static int mode = 0;
 
-static struct poptOption optionsTable[] = {
-    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
-       N_("Common options for all rpm modes and executables:"), NULL },
+static struct poptOption signOptsTable[] = {
     { "addsign", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_ADDSIGN,
        N_("sign package(s)"), NULL },
     { "resign", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_RESIGN,
        N_("sign package(s) (identical to --addsign)"), NULL },
     { "delsign", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_DELSIGN,
        N_("delete package signatures"), NULL },
+    POPT_TABLEEND
+};
+
+static struct poptOption optionsTable[] = {
+    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, signOptsTable, 0,
+       N_("Signature options:"), NULL },
+    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
+       N_("Common options for all rpm modes and executables:"), NULL },
 
     POPT_AUTOALIAS
     POPT_AUTOHELP
index ecc4434..95cf98e 100644 (file)
--- a/rpmspec.c
+++ b/rpmspec.c
@@ -20,8 +20,7 @@ static int source = RPMQV_SPECRPMS;
 const char *target = NULL;
 char *queryformat = NULL;
 
-/* the structure describing the options we take and the defaults */
-static struct poptOption optionsTable[] = {
+static struct poptOption specOptsTable[] = {
     { "query", 'q', POPT_ARG_VAL, &mode, MODE_QUERY,
        N_("query spec file(s)"), NULL },
     { "rpms", 0, POPT_ARG_VAL, &source, RPMQV_SPECRPMS,
@@ -34,6 +33,13 @@ static struct poptOption optionsTable[] = {
        N_("use the following query format"), "QUERYFORMAT" },
     { "qf", 0, (POPT_ARG_STRING | POPT_ARGFLAG_DOC_HIDDEN), &queryformat, 0,
        NULL, NULL },
+    POPT_TABLEEND
+};
+
+/* the structure describing the options we take and the defaults */
+static struct poptOption optionsTable[] = {
+    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, specOptsTable, 0,
+       N_("Spec options:"), NULL },
 
     { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
        N_("Common options for all rpm modes and executables:"), NULL },