app: Switch subcommands to use "base" RpmOstreeCommand struct

They were just duplicates.  Prepartory cleanup for future patches.

Closes: #681
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-03-15 14:18:23 -04:00 committed by Atomic Bot
parent 24faf942df
commit 7e4f56a862
4 changed files with 12 additions and 32 deletions

View File

@ -28,12 +28,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
typedef struct { static RpmOstreeCommand compose_subcommands[] = {
const char *name;
int (*fn) (int argc, char **argv, GCancellable *cancellable, GError **error);
} RpmOstreeComposeCommand;
static RpmOstreeComposeCommand compose_subcommands[] = {
{ "tree", rpmostree_compose_builtin_tree }, { "tree", rpmostree_compose_builtin_tree },
{ NULL, NULL } { NULL, NULL }
}; };
@ -41,7 +36,7 @@ static RpmOstreeComposeCommand compose_subcommands[] = {
static GOptionContext * static GOptionContext *
compose_option_context_new_with_commands (void) compose_option_context_new_with_commands (void)
{ {
RpmOstreeComposeCommand *command = compose_subcommands; RpmOstreeCommand *command = compose_subcommands;
GOptionContext *context; GOptionContext *context;
GString *summary; GString *summary;
@ -65,7 +60,7 @@ compose_option_context_new_with_commands (void)
int int
rpmostree_builtin_compose (int argc, char **argv, GCancellable *cancellable, GError **error) rpmostree_builtin_compose (int argc, char **argv, GCancellable *cancellable, GError **error)
{ {
RpmOstreeComposeCommand *subcommand; RpmOstreeCommand *subcommand;
const char *subcommand_name = NULL; const char *subcommand_name = NULL;
g_autofree char *prgname = NULL; g_autofree char *prgname = NULL;
int exit_status = EXIT_SUCCESS; int exit_status = EXIT_SUCCESS;

View File

@ -23,12 +23,7 @@
#include "rpmostree-container-builtins.h" #include "rpmostree-container-builtins.h"
#include "rpmostree-rpm-util.h" #include "rpmostree-rpm-util.h"
typedef struct { static RpmOstreeCommand container_subcommands[] = {
const char *name;
int (*fn) (int argc, char **argv, GCancellable *cancellable, GError **error);
} RpmOstreeContainerCommand;
static RpmOstreeContainerCommand container_subcommands[] = {
{ "init", rpmostree_container_builtin_init }, { "init", rpmostree_container_builtin_init },
{ "assemble", rpmostree_container_builtin_assemble }, { "assemble", rpmostree_container_builtin_assemble },
/* { "start", rpmostree_container_builtin_start }, */ /* { "start", rpmostree_container_builtin_start }, */
@ -39,7 +34,7 @@ static RpmOstreeContainerCommand container_subcommands[] = {
static GOptionContext * static GOptionContext *
container_option_context_new_with_commands (void) container_option_context_new_with_commands (void)
{ {
RpmOstreeContainerCommand *command = container_subcommands; RpmOstreeCommand *command = container_subcommands;
GOptionContext *context; GOptionContext *context;
GString *summary; GString *summary;
@ -63,7 +58,7 @@ container_option_context_new_with_commands (void)
int int
rpmostree_builtin_container (int argc, char **argv, GCancellable *cancellable, GError **error) rpmostree_builtin_container (int argc, char **argv, GCancellable *cancellable, GError **error)
{ {
RpmOstreeContainerCommand *subcommand; RpmOstreeCommand *subcommand;
const char *subcommand_name = NULL; const char *subcommand_name = NULL;
g_autofree char *prgname = NULL; g_autofree char *prgname = NULL;
int exit_status = EXIT_SUCCESS; int exit_status = EXIT_SUCCESS;

View File

@ -23,12 +23,7 @@
#include "rpmostree-db-builtins.h" #include "rpmostree-db-builtins.h"
#include "rpmostree-rpm-util.h" #include "rpmostree-rpm-util.h"
typedef struct { static RpmOstreeCommand rpm_subcommands[] = {
const char *name;
int (*fn) (int argc, char **argv, GCancellable *cancellable, GError **error);
} RpmOstreeDbCommand;
static RpmOstreeDbCommand rpm_subcommands[] = {
{ "diff", rpmostree_db_builtin_diff }, { "diff", rpmostree_db_builtin_diff },
{ "list", rpmostree_db_builtin_list }, { "list", rpmostree_db_builtin_list },
{ "version", rpmostree_db_builtin_version }, { "version", rpmostree_db_builtin_version },
@ -45,7 +40,7 @@ static GOptionEntry global_entries[] = {
static GOptionContext * static GOptionContext *
rpm_option_context_new_with_commands (void) rpm_option_context_new_with_commands (void)
{ {
RpmOstreeDbCommand *command = rpm_subcommands; RpmOstreeCommand *command = rpm_subcommands;
GOptionContext *context; GOptionContext *context;
GString *summary; GString *summary;
@ -127,7 +122,7 @@ out:
int int
rpmostree_builtin_db (int argc, char **argv, GCancellable *cancellable, GError **error) rpmostree_builtin_db (int argc, char **argv, GCancellable *cancellable, GError **error)
{ {
RpmOstreeDbCommand *subcommand; RpmOstreeCommand *subcommand;
const char *subcommand_name = NULL; const char *subcommand_name = NULL;
g_autofree char *prgname = NULL; g_autofree char *prgname = NULL;
int exit_status = EXIT_SUCCESS; int exit_status = EXIT_SUCCESS;

View File

@ -23,12 +23,7 @@
#include "rpmostree-internals-builtins.h" #include "rpmostree-internals-builtins.h"
#include "rpmostree-rpm-util.h" #include "rpmostree-rpm-util.h"
typedef struct { static RpmOstreeCommand internals_subcommands[] = {
const char *name;
int (*fn) (int argc, char **argv, GCancellable *cancellable, GError **error);
} RpmOstreeInternalsCommand;
static RpmOstreeInternalsCommand internals_subcommands[] = {
{ "unpack", rpmostree_internals_builtin_unpack }, { "unpack", rpmostree_internals_builtin_unpack },
{ NULL, NULL } { NULL, NULL }
}; };
@ -42,7 +37,7 @@ static GOptionEntry global_entries[] = {
static GOptionContext * static GOptionContext *
internals_option_context_new_with_commands (void) internals_option_context_new_with_commands (void)
{ {
RpmOstreeInternalsCommand *command = internals_subcommands; RpmOstreeCommand *command = internals_subcommands;
GOptionContext *context; GOptionContext *context;
GString *summary; GString *summary;
@ -66,7 +61,7 @@ internals_option_context_new_with_commands (void)
int int
rpmostree_builtin_internals (int argc, char **argv, GCancellable *cancellable, GError **error) rpmostree_builtin_internals (int argc, char **argv, GCancellable *cancellable, GError **error)
{ {
RpmOstreeInternalsCommand *subcommand; RpmOstreeCommand *subcommand;
const char *subcommand_name = NULL; const char *subcommand_name = NULL;
g_autofree char *prgname = NULL; g_autofree char *prgname = NULL;
int exit_status = EXIT_SUCCESS; int exit_status = EXIT_SUCCESS;