app/uninstall: remove --cache-only option

The `--cache-only` option was added to the generic `option_entries`
array, which is shared by both `install` and `uninstall`. But really, it
only makes sense for `install`. Move it to the `install` specific array
instead.

I also renamed the option entry arrays to make more sense. Before, the
`install_option_entries` referred to the additional options that the
`uninstall` command took. Now the names refer to the command to which
they're associated.

Closes: #1053
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2017-10-13 13:20:10 +00:00 committed by Atomic Bot
parent 74eaa2ba59
commit 24cff4f5e0

View File

@ -40,17 +40,17 @@ static GOptionEntry option_entries[] = {
{ "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Operate on provided OSNAME", "OSNAME" }, { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Operate on provided OSNAME", "OSNAME" },
{ "reboot", 'r', 0, G_OPTION_ARG_NONE, &opt_reboot, "Initiate a reboot after upgrade is prepared", NULL }, { "reboot", 'r', 0, G_OPTION_ARG_NONE, &opt_reboot, "Initiate a reboot after upgrade is prepared", NULL },
{ "dry-run", 'n', 0, G_OPTION_ARG_NONE, &opt_dry_run, "Exit after printing the transaction", NULL }, { "dry-run", 'n', 0, G_OPTION_ARG_NONE, &opt_dry_run, "Exit after printing the transaction", NULL },
{ "cache-only", 'C', 0, G_OPTION_ARG_NONE, &opt_cache_only, "Do not update repo metadata cache", NULL },
{ NULL }
};
static GOptionEntry install_option_entry[] = {
{ "install", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_install, "Install a package", "PKG" },
{ NULL } { NULL }
}; };
static GOptionEntry uninstall_option_entry[] = { static GOptionEntry uninstall_option_entry[] = {
{ "install", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_install, "Install a package", "PKG" },
{ NULL }
};
static GOptionEntry install_option_entry[] = {
{ "uninstall", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_uninstall, "Uninstall a package", "PKG" }, { "uninstall", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_uninstall, "Uninstall a package", "PKG" },
{ "cache-only", 'C', 0, G_OPTION_ARG_NONE, &opt_cache_only, "Do not update repo metadata cache", NULL },
{ NULL } { NULL }
}; };
@ -139,7 +139,7 @@ rpmostree_builtin_install (int argc,
context = g_option_context_new ("PACKAGE [PACKAGE...]"); context = g_option_context_new ("PACKAGE [PACKAGE...]");
g_option_context_add_main_entries (context, uninstall_option_entry, NULL); g_option_context_add_main_entries (context, install_option_entry, NULL);
if (!rpmostree_option_context_parse (context, if (!rpmostree_option_context_parse (context,
option_entries, option_entries,
@ -182,7 +182,7 @@ rpmostree_builtin_uninstall (int argc,
context = g_option_context_new ("PACKAGE [PACKAGE...]"); context = g_option_context_new ("PACKAGE [PACKAGE...]");
g_option_context_add_main_entries (context, install_option_entry, NULL); g_option_context_add_main_entries (context, uninstall_option_entry, NULL);
if (!rpmostree_option_context_parse (context, if (!rpmostree_option_context_parse (context,
option_entries, option_entries,