summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2010-10-08 18:08:48 -0400
committerDavid Zeuthen <davidz@redhat.com>2010-10-08 18:08:48 -0400
commit86300b6389dffdfca9909de8a1ceec0d428211c3 (patch)
tree0e07fb573e2d1a8af50dc11ee60fb4a501d9751c
parentc7a7816a733bea7be49989805dc5e019aef0d651 (diff)
Drop the --id part 'stc start' and 'stc stop'
Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/stc.xml4
-rw-r--r--doc/stcd.xml2
-rw-r--r--stc/stc.c32
4 files changed, 22 insertions, 18 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
index c6ac137..730e44d 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -86,6 +86,6 @@ CLEANFILES += \
$(DOC_MODULE).signals \
*.stamp \
-rf xml html tmpl \
- stc.1 \
+ *.5 *.8 \
$(NULL)
diff --git a/doc/stc.xml b/doc/stc.xml
index 781ad43..46e5ca7 100644
--- a/doc/stc.xml
+++ b/doc/stc.xml
@@ -14,7 +14,7 @@
<cmdsynopsis>
<command>stc</command>
<arg choice="plain">start</arg>
- <arg choice="plain">--id <replaceable>item_identifier</replaceable></arg>
+ <arg choice="plain"><replaceable>item_identifier</replaceable></arg>
<group>
<arg choice="plain">--allow-degraded</arg>
</group>
@@ -23,7 +23,7 @@
<cmdsynopsis>
<command>stc</command>
<arg choice="plain">stop</arg>
- <arg choice="plain">--id <replaceable>item_identifier</replaceable></arg>
+ <arg choice="plain"><replaceable>item_identifier</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
diff --git a/doc/stcd.xml b/doc/stcd.xml
index ae381c1..14dbee6 100644
--- a/doc/stcd.xml
+++ b/doc/stcd.xml
@@ -1,4 +1,4 @@
-<refentry id="stc" lang="en">
+<refentry id="stcd" lang="en">
<refmeta>
<refentrytitle>stcd</refentrytitle>
<manvolnum>8</manvolnum>
diff --git a/stc/stc.c b/stc/stc.c
index 8213bb6..f809ebc 100644
--- a/stc/stc.c
+++ b/stc/stc.c
@@ -555,7 +555,6 @@ ask_user (const gchar *info,
/* ---------------------------------------------------------------------------------------------------- */
-static gchar *opt_start_stop_id = NULL;
static gboolean opt_start_allow_degraded = FALSE;
static gboolean
@@ -806,14 +805,12 @@ on_stopped (StcOperation *operation,
static const GOptionEntry command_start_entries[] =
{
- { "id", 'i', 0, G_OPTION_ARG_STRING, &opt_start_stop_id, "Configuration item", NULL},
{ "allow-degraded", 'd', 0, G_OPTION_ARG_NONE, &opt_start_allow_degraded, "Answer yes to whether it's OK to start degraded", NULL},
{ NULL }
};
static const GOptionEntry command_stop_entries[] =
{
- { "id", 'i', 0, G_OPTION_ARG_STRING, &opt_start_stop_id, "Configuration item", NULL},
{ NULL }
};
@@ -835,11 +832,12 @@ handle_command_start_stop (gint *argc,
gboolean complete_ids;
GError *error;
StcOperation *operation;
+ gchar *id;
ret = 1;
monitor = NULL;
item = NULL;
- opt_start_stop_id = NULL;
+ id = NULL;
operation = NULL;
modify_argv0_for_command (argc, argv, is_start ? "start" : "stop");
@@ -854,12 +852,23 @@ handle_command_start_stop (gint *argc,
NULL /* GETTEXT_PACKAGE*/);
complete_ids = FALSE;
- if (request_completion && (g_strcmp0 (completion_prev, "--id") == 0 || g_strcmp0 (completion_prev, "-i") == 0))
+ if (request_completion && g_strcmp0 (completion_prev, is_start ? "start" : "stop") == 0)
{
complete_ids = TRUE;
remove_arg ((*argc) - 1, argc, argv);
}
+ if (*argc >= 2)
+ {
+ const gchar *potential_id;
+ potential_id = (*argv)[1];
+ if (potential_id[0] != '-') /* it could be the user typing 'stc start --help' */
+ {
+ id = g_strdup (potential_id);
+ remove_arg (1, argc, argv);
+ }
+ }
+
if (!g_option_context_parse (o, argc, argv, NULL))
{
if (!request_completion)
@@ -871,12 +880,6 @@ handle_command_start_stop (gint *argc,
}
}
- if (request_completion &&
- (opt_start_stop_id == NULL && !complete_ids))
- {
- g_print ("--id \n");
- }
-
if (request_completion && is_start &&
(!opt_start_allow_degraded && !complete_ids))
{
@@ -918,12 +921,12 @@ handle_command_start_stop (gint *argc,
if (request_completion)
goto out;
- if (opt_start_stop_id != NULL)
+ if (id != NULL)
{
- item = stc_monitor_get_item_by_id (monitor, opt_start_stop_id);
+ item = stc_monitor_get_item_by_id (monitor, id);
if (item == NULL)
{
- g_printerr ("Error looking up item with id %s\n", opt_start_stop_id);
+ g_printerr ("Error looking up item with id %s\n", id);
goto out;
}
}
@@ -991,6 +994,7 @@ handle_command_start_stop (gint *argc,
ret = 0;
out:
+ g_free (id);
if (operation != NULL)
g_object_unref (operation);
if (item != NULL)