aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-04-25 14:34:18 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2013-04-25 14:34:18 +0300
commit1efebd2b5fd9e04c892500a1108ccbd20c146f31 (patch)
tree95adbbbc451de1ba0337c3564b9d91d61718b9bd /src
parent02e09c1128a6e489a52390867c81fc886cb74273 (diff)
downloadeclat-1efebd2b5fd9e04c892500a1108ccbd20c146f31.tar.gz
eclat-1efebd2b5fd9e04c892500a1108ccbd20c146f31.tar.bz2
Improve help and usage output.
* NEWS: Version 0.9.90 * configure.ac: Likewise. * grecs: Upgrade. * src/allocaddr-cl.opt: Use OPTIONS_COMMAND_BEGIN to declare subcommand. Remove the nousage flag. * src/cpimg-cl.opt: Likewise. * src/cpsnap-cl.opt: Likewise. * src/asscaddr-cl.opt: Likewise. * src/detvol-cl.opt: Likewise. * src/disasaddr-cl.opt: Likewise. * src/freeaddr-cl.opt: Likewise. * src/lsaddr-cl.opt: Likewise. * src/lsattr-cl.opt: Likewise. * src/lsimg-cl.opt: Likewise. * src/lsistat-cl.opt: Likewise. * src/lssg-cl.opt: Likewise. * src/lssnap-cl.opt: Likewise. * src/lstag-cl.opt: Likewise. * src/mkimg-cl.opt: Likewise. * src/mkinst-cl.opt: Likewise. * src/mktags-cl.opt: Likewise. * src/mkvol-cl.opt: Likewise. * src/generic-cl.opt (generic_parse_options): Change signature. Use subcmd member of struct grecs_proginfo. * src/eclat.h (eclat_do_command): New proto. (generic_parse_options): Change signature. * src/atvol.c: Update call to generic_parse_options. * src/deimg.c: Likewise. * src/getconout.c: Likewise. * src/lsiattr.c: Likewise. * src/lsinst.c: Likewise. * src/lsreg.c: Likewise. * src/lssattr.c: Likewise. * src/lsvol.c: Likewise. * src/lszon.c: Likewise. * src/mksnap.c: Likewise. * src/rmsnap.c: Likewise. * src/rmvol.c: Likewise. * src/setiattr.c: Likewise. * src/startstop.c: Likewise. * src/util.c (translate_ids): Remove unused variable.
Diffstat (limited to 'src')
-rw-r--r--src/allocaddr-cl.opt4
-rw-r--r--src/asscaddr-cl.opt4
-rw-r--r--src/atvol.c2
-rw-r--r--src/cpimg-cl.opt3
-rw-r--r--src/cpsnap-cl.opt3
-rw-r--r--src/deimg.c4
-rw-r--r--src/detvol-cl.opt4
-rw-r--r--src/disasaddr-cl.opt4
-rw-r--r--src/eclat.h5
-rw-r--r--src/freeaddr-cl.opt4
-rw-r--r--src/generic-cl.opt9
-rw-r--r--src/getconout.c2
-rw-r--r--src/lsaddr-cl.opt4
-rw-r--r--src/lsattr-cl.opt4
-rw-r--r--src/lsiattr.c2
-rw-r--r--src/lsimg-cl.opt4
-rw-r--r--src/lsinst.c7
-rw-r--r--src/lsistat-cl.opt4
-rw-r--r--src/lsreg.c7
-rw-r--r--src/lssattr.c6
-rw-r--r--src/lssg-cl.opt4
-rw-r--r--src/lssnap-cl.opt4
-rw-r--r--src/lstag-cl.opt4
-rw-r--r--src/lsvol.c2
-rw-r--r--src/lszon.c10
-rw-r--r--src/mkimg-cl.opt4
-rw-r--r--src/mkinst-cl.opt4
-rw-r--r--src/mksnap.c2
-rw-r--r--src/mktags-cl.opt4
-rw-r--r--src/mkvol-cl.opt4
-rw-r--r--src/rmsnap.c2
-rw-r--r--src/rmvol.c2
-rw-r--r--src/setiattr.c2
-rw-r--r--src/startstop.c11
-rw-r--r--src/util.c2
35 files changed, 79 insertions, 68 deletions
diff --git a/src/allocaddr-cl.opt b/src/allocaddr-cl.opt
index 4c07803..c618375 100644
--- a/src/allocaddr-cl.opt
+++ b/src/allocaddr-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat allocate-address",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<allocaddr, allocate-address>],
[<allocate Elastic IP address>],
[<>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(vpc,v,,
diff --git a/src/asscaddr-cl.opt b/src/asscaddr-cl.opt
index 3c63e19..87846e3 100644
--- a/src/asscaddr-cl.opt
+++ b/src/asscaddr-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat associate-address",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<asscaddr, associate-address>],
[<associate IP address with an instance>],
[<INSTANCE IP-OR-ALLOC-ID>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(vpc,v,,
diff --git a/src/atvol.c b/src/atvol.c
index de81454..2ee452b 100644
--- a/src/atvol.c
+++ b/src/atvol.c
@@ -22,7 +22,7 @@ eclat_attach_volume(eclat_command_env_t *env, int argc, char **argv)
int i;
generic_proginfo->args_doc = "VOL-ID INST-ID DEV-NAME";
- generic_parse_options("eclat attach-volume",
+ generic_parse_options(env->cmd,
"attach a volume to an instance",
argc, argv, &i);
diff --git a/src/cpimg-cl.opt b/src/cpimg-cl.opt
index d31bb92..4a01386 100644
--- a/src/cpimg-cl.opt
+++ b/src/cpimg-cl.opt
@@ -19,7 +19,8 @@ char *image;
char *name;
char *descr;
-OPTIONS_BEGIN("eclat copy-image",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<cpimg, copy-image>],
[<copy an AMI from another region>],
[<REGION AMI-ID>],
[<gnu>],
diff --git a/src/cpsnap-cl.opt b/src/cpsnap-cl.opt
index e53a2cc..13423b5 100644
--- a/src/cpsnap-cl.opt
+++ b/src/cpsnap-cl.opt
@@ -18,7 +18,8 @@ char *region;
char *image;
char *descr;
-OPTIONS_BEGIN("eclat copy-snapshot",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<cpsnap, copy-snapshot>],
[<copy snapshot from another region>],
[<REGION SNAP-ID>],
[<gnu>],
diff --git a/src/deimg.c b/src/deimg.c
index 73fda13..4a76d39 100644
--- a/src/deimg.c
+++ b/src/deimg.c
@@ -22,9 +22,7 @@ eclat_deregister_image(eclat_command_env_t *env, int argc, char **argv)
int i;
generic_proginfo->args_doc = "AMI-ID";
- generic_parse_options("eclat deregister-image",
- "deregister AMI",
- argc, argv, &i);
+ generic_parse_options(env->cmd, "deregister AMI", argc, argv, &i);
argv += i;
argc -= i;
diff --git a/src/detvol-cl.opt b/src/detvol-cl.opt
index b1781b4..2acf20b 100644
--- a/src/detvol-cl.opt
+++ b/src/detvol-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat detach-volume",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<devol, detach-volume>],
[<detach a volume from instance>],
[<VOL-ID [INST-ID [DEV-NAME]]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(force,f,,
diff --git a/src/disasaddr-cl.opt b/src/disasaddr-cl.opt
index 9be979b..0695387 100644
--- a/src/disasaddr-cl.opt
+++ b/src/disasaddr-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat disassociate-address",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<disasadr, disassociate-address>],
[<disassociate IP address from instance>],
[<IP-OR-ALLOC-ID>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(vpc,v,,
diff --git a/src/eclat.h b/src/eclat.h
index 73bf25c..d4d863f 100644
--- a/src/eclat.h
+++ b/src/eclat.h
@@ -85,6 +85,8 @@ struct eclat_command {
};
struct eclat_command *find_command_name(const char *name);
+int eclat_do_command(eclat_command_env_t *env, struct eclat_command *command,
+ int argc, char **argv);
int eclat_start_instance(eclat_command_env_t *env, int argc, char **argv);
int eclat_stop_instance(eclat_command_env_t *env, int argc, char **argv);
@@ -176,7 +178,8 @@ int get_access_creds(const char *id, char **access_key_ptr,
void define_format(const char *name, const char *fmt, grecs_locus_t *loc);
forlan_eval_env_t find_format(const char *name);
-void generic_parse_options(const char *pname, const char *docstring,
+void generic_parse_options(struct eclat_command const *command,
+ const char *docstring,
int argc, char *argv[], int *index);
extern struct grecs_proginfo *generic_proginfo;
diff --git a/src/freeaddr-cl.opt b/src/freeaddr-cl.opt
index 73a241a..5f3a3f9 100644
--- a/src/freeaddr-cl.opt
+++ b/src/freeaddr-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat release-address",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<freeaddr, release-address>],
[<release Elastic IP address>],
[<IP-OR-ALLOCID>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(vpc,v,,
diff --git a/src/generic-cl.opt b/src/generic-cl.opt
index 553f454..81c3524 100644
--- a/src/generic-cl.opt
+++ b/src/generic-cl.opt
@@ -18,7 +18,6 @@ OPTIONS_BEGIN(NULL,
[<>],
[<[FILTER...]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTIONS_END
@@ -26,10 +25,14 @@ OPTIONS_END
struct grecs_proginfo *generic_proginfo = &proginfo;
void
-generic_parse_options(const char *pname, const char *docstring,
+generic_parse_options(struct eclat_command const *command,
+ const char *docstring,
int argc, char *argv[], int *index)
{
- proginfo.progname = pname;
+ const char *cmds[3] = { command->name, command->ident, NULL };
+
+ proginfo.progname = "eclat";
+ proginfo.subcmd = (char**) cmds;
proginfo.docstring = docstring;
GETOPT(argc, argv, *index, exit(EX_USAGE))
}
diff --git a/src/getconout.c b/src/getconout.c
index 222d61c..a00f4cb 100644
--- a/src/getconout.c
+++ b/src/getconout.c
@@ -22,7 +22,7 @@ eclat_get_console_output(eclat_command_env_t *env, int argc, char **argv)
int i;
generic_proginfo->args_doc = "ID";
- generic_parse_options("eclat get-console-output",
+ generic_parse_options(env->cmd,
"retrieve console output for the specified "
"instance",
argc, argv, &i);
diff --git a/src/lsaddr-cl.opt b/src/lsaddr-cl.opt
index 9cab163..071bb27 100644
--- a/src/lsaddr-cl.opt
+++ b/src/lsaddr-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat describe-addresses",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<lsaddr, describe-addresses>],
[<describe elastic IP addresses>],
[<[FILTER...]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(vpc,v,,
diff --git a/src/lsattr-cl.opt b/src/lsattr-cl.opt
index 3a51377..a50deb6 100644
--- a/src/lsattr-cl.opt
+++ b/src/lsattr-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat lsattr",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<lsattr>],
[<List EC2 resource attributes>],
[<ID [ATTR]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(instance,i,,
diff --git a/src/lsiattr.c b/src/lsiattr.c
index d6d8b64..633e94d 100644
--- a/src/lsiattr.c
+++ b/src/lsiattr.c
@@ -41,7 +41,7 @@ eclat_describe_instance_attribute(eclat_command_env_t *env, int argc, char **arg
generic_proginfo->args_doc = "INST-ID ATTR";
available_attrs = attrs;
generic_proginfo->print_help_hook = list_attrs;
- generic_parse_options("eclat describe-instance-attribute",
+ generic_parse_options(env->cmd,
"describe the specified attribute of the instance",
argc, argv, &i);
argv += i;
diff --git a/src/lsimg-cl.opt b/src/lsimg-cl.opt
index a176e60..955b960 100644
--- a/src/lsimg-cl.opt
+++ b/src/lsimg-cl.opt
@@ -17,11 +17,11 @@
static int owner_n;
static int xby_n;
-OPTIONS_BEGIN("eclat describe-images",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<lsimg, describe-images>],
[<describe Amazon images>],
[<[FILTER...] [AMI...]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(all,a,,
diff --git a/src/lsinst.c b/src/lsinst.c
index 8101a71..4cf4a34 100644
--- a/src/lsinst.c
+++ b/src/lsinst.c
@@ -17,7 +17,8 @@
#include "eclat.h"
static void
-parse_options(int argc, char *argv[], int *index)
+parse_options(struct eclat_command const *cmd, int argc, char *argv[],
+ int *index)
{
static char *architecture_str[] = { "i386", "x86_64", NULL };
static char *lifecycle_str[] = { "spot", NULL };
@@ -131,7 +132,7 @@ parse_options(int argc, char *argv[], int *index)
available_filters = filters;
generic_proginfo->print_help_hook = list_filters;
- return generic_parse_options("eclat describe-instances",
+ return generic_parse_options(cmd,
"List instances",
argc, argv, index);
}
@@ -141,7 +142,7 @@ eclat_describe_instances(eclat_command_env_t *env, int argc, char **argv)
{
int i;
- parse_options(argc, argv, &i);
+ parse_options(env->cmd, argc, argv, &i);
argv += i;
argc -= i;
translate_ids(argc, argv, "InstanceId");
diff --git a/src/lsistat-cl.opt b/src/lsistat-cl.opt
index 20202c0..2807b73 100644
--- a/src/lsistat-cl.opt
+++ b/src/lsistat-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat describe-instance-status",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<lsistat, describe-instance-status>],
[<describe the status of Amazon EC2 instances including any scheduled events>],
[<[FILTER...]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(all,a,,
diff --git a/src/lsreg.c b/src/lsreg.c
index 0d2ba2d..ef2cafb 100644
--- a/src/lsreg.c
+++ b/src/lsreg.c
@@ -17,7 +17,8 @@
#include "eclat.h"
static void
-parse_options(int argc, char *argv[], int *index)
+parse_options(struct eclat_command const *cmd,
+ int argc, char *argv[], int *index)
{
static struct filter_descr filters[] = {
{ "endpoint", FILTER_STRING },
@@ -28,7 +29,7 @@ parse_options(int argc, char *argv[], int *index)
available_filters = filters;
generic_proginfo->print_help_hook = list_filters;
generic_proginfo->args_doc = "[REGION [REGION...]]";
- return generic_parse_options("eclat describe-regiones",
+ return generic_parse_options(cmd,
"List available regions",
argc, argv, index);
}
@@ -38,7 +39,7 @@ eclat_describe_regions(eclat_command_env_t *env, int argc, char **argv)
{
int i;
- parse_options(argc, argv, &i);
+ parse_options(env->cmd, argc, argv, &i);
argv += i;
argc -= i;
translate_ids(argc, argv, "reg");
diff --git a/src/lssattr.c b/src/lssattr.c
index 92778db..c3deb23 100644
--- a/src/lssattr.c
+++ b/src/lssattr.c
@@ -45,7 +45,7 @@ eclat_describe_snapshot_attribute(eclat_command_env_t *env,
generic_proginfo->args_doc = "SNAP-ID [ATTR]";
available_attrs = attrs;
generic_proginfo->print_help_hook = list_attrs;
- generic_parse_options("eclat describe-snapshot-attribute",
+ generic_parse_options(env->cmd,
"describe the attribute of a snapshot",
argc, argv, &i);
argv += i;
@@ -96,7 +96,7 @@ eclat_modify_snapshot_attribute(eclat_command_env_t *env,
size_t bufsize = 0;
generic_proginfo->args_doc = "{g|u}{-|+}{all|ID} SNAP-ID";
- generic_parse_options("eclat modify-snapshot-attribute",
+ generic_parse_options(env->cmd,
"modify the createVolumePermission attribute of a snapshot",
argc, argv, &i);
argv += i;
@@ -153,7 +153,7 @@ eclat_reset_snapshot_attribute(eclat_command_env_t *env,
struct ec2_query *q = env->query;
generic_proginfo->args_doc = "SNAP-ID";
- generic_parse_options("eclat reset-snapshot-attribute",
+ generic_parse_options(env->cmd,
"reset the createVolumePermission attribute of a snapshot",
argc, argv, &i);
argv += i;
diff --git a/src/lssg-cl.opt b/src/lssg-cl.opt
index 2f6ad69..3898708 100644
--- a/src/lssg-cl.opt
+++ b/src/lssg-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat describe-security-groups",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<lssg, describe-security-groups>],
[<returns information about security groups>],
[<[FILTER...] [ID...]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(name,n,,
diff --git a/src/lssnap-cl.opt b/src/lssnap-cl.opt
index a524165..be1f0d9 100644
--- a/src/lssnap-cl.opt
+++ b/src/lssnap-cl.opt
@@ -24,11 +24,11 @@ struct param {
static unsigned owner_idx = 1, rstby_idx = 1;
-OPTIONS_BEGIN("eclat describe-snapshots",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<lssnap, describe-snapshots>],
[<describe EC2 snapshots>],
[<[SNAP-ID...] [FILTER...]]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(owner,u,[<ID|self|amazon>],
diff --git a/src/lstag-cl.opt b/src/lstag-cl.opt
index 4adfea0..af8064d 100644
--- a/src/lstag-cl.opt
+++ b/src/lstag-cl.opt
@@ -21,11 +21,11 @@ struct resource {
char *resid;
};
-OPTIONS_BEGIN("eclat describe-tags",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<lstag, describe-tags>],
[<List tags and their values>],
[<[FILTER...]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(resource-id,r,[<[MAP:]ID>],
diff --git a/src/lsvol.c b/src/lsvol.c
index 030701b..d52722d 100644
--- a/src/lsvol.c
+++ b/src/lsvol.c
@@ -51,7 +51,7 @@ eclat_describe_volumes(eclat_command_env_t *env, int argc, char **argv)
available_filters = filters;
generic_proginfo->print_help_hook = list_filters;
generic_proginfo->args_doc = "[FILTER...] [ID...]";
- generic_parse_options("eclat describe-volumes",
+ generic_parse_options(env->cmd,
"describe Amazon EBS volumes",
argc, argv, &i);
argv += i;
diff --git a/src/lszon.c b/src/lszon.c
index 499c3bc..d5c06df 100644
--- a/src/lszon.c
+++ b/src/lszon.c
@@ -17,7 +17,8 @@
#include "eclat.h"
static void
-parse_options(int argc, char *argv[], int *index)
+parse_options(struct eclat_command const *cmd,
+ int argc, char *argv[], int *index)
{
static char *states[] = {
"available", NULL
@@ -34,17 +35,18 @@ parse_options(int argc, char *argv[], int *index)
available_filters = filters;
generic_proginfo->print_help_hook = list_filters;
generic_proginfo->args_doc = "[ZONE [ZONE...]]";
- return generic_parse_options("eclat describe-availability-zones",
+ return generic_parse_options(cmd,
"List availability zones",
argc, argv, index);
}
int
-eclat_describe_avaialbility_zones(eclat_command_env_t *env, int argc, char **argv)
+eclat_describe_avaialbility_zones(eclat_command_env_t *env,
+ int argc, char **argv)
{
int i;
- parse_options(argc, argv, &i);
+ parse_options(env->cmd, argc, argv, &i);
argv += i;
argc -= i;
translate_ids(argc, argv, "AZ");
diff --git a/src/mkimg-cl.opt b/src/mkimg-cl.opt
index 18c9716..d905773 100644
--- a/src/mkimg-cl.opt
+++ b/src/mkimg-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat create-image",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<mkimg, create-image>],
[<create an AMI>],
[<NAME INSTANCE>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(description,d,[<STRING>],
diff --git a/src/mkinst-cl.opt b/src/mkinst-cl.opt
index 9852e70..15778d1 100644
--- a/src/mkinst-cl.opt
+++ b/src/mkinst-cl.opt
@@ -61,11 +61,11 @@ read_user_data(const char *file)
user_data[st.st_size] = 0;
}
-OPTIONS_BEGIN("eclat run-instances",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<mkinst, run-instances>],
[<launch new instances>],
[<AMI-ID>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(,n,[<N>],
diff --git a/src/mksnap.c b/src/mksnap.c
index 5a6378f..66a12f3 100644
--- a/src/mksnap.c
+++ b/src/mksnap.c
@@ -25,7 +25,7 @@ eclat_create_snapshot(eclat_command_env_t *env, int argc, char **argv)
generic_proginfo->args_doc = "VOL-ID [DESCR]";
generic_proginfo->docstring = "create a snapshot of an Amazon EBS volume";
- generic_parse_options("eclat create-snapshot",
+ generic_parse_options(env->cmd,
"create a snapshot of an Amazon EBS volume",
argc, argv, &i);
argc -= i;
diff --git a/src/mktags-cl.opt b/src/mktags-cl.opt
index 0ca52e3..9da23ae 100644
--- a/src/mktags-cl.opt
+++ b/src/mktags-cl.opt
@@ -22,11 +22,11 @@ struct resource {
char *resid;
};
-OPTIONS_BEGIN("eclat create-tags",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<mktags, create-tags>],
[<create tags for the specified resources>],
[<TAG[=VALUE] [TAG[=VALUE...]]>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(resource-id,r,[<[MAP:]ID>],
diff --git a/src/mkvol-cl.opt b/src/mkvol-cl.opt
index a3ae861..1f21637 100644
--- a/src/mkvol-cl.opt
+++ b/src/mkvol-cl.opt
@@ -14,11 +14,11 @@
You should have received a copy of the GNU General Public License
along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-OPTIONS_BEGIN("eclat create-volume",
+OPTIONS_COMMAND_BEGIN("eclat",
+ [<mkvol, create-volume>],
[<create EC2 volume>],
[<SIZE ZONE>],
[<gnu>],
- [<nousage>],
[<noversion>])
OPTION(iops,i,[<IOPS>],
diff --git a/src/rmsnap.c b/src/rmsnap.c
index 4f32185..1446433 100644
--- a/src/rmsnap.c
+++ b/src/rmsnap.c
@@ -23,7 +23,7 @@ eclat_delete_snapshot(eclat_command_env_t *env, int argc, char **argv)
struct ec2_query *q = env->query;
generic_proginfo->args_doc = "SNAP-ID";
- generic_parse_options("eclat delete-snapshot",
+ generic_parse_options(env->cmd,
"delete a EC2 volume snapshot",
argc, argv, &i);
argc -= i;
diff --git a/src/rmvol.c b/src/rmvol.c
index bf0f565..856b245 100644
--- a/src/rmvol.c
+++ b/src/rmvol.c
@@ -23,7 +23,7 @@ eclat_delete_volume(eclat_command_env_t *env, int argc, char **argv)
struct ec2_query *q = env->query;
generic_proginfo->args_doc = "VOL-ID";
- generic_parse_options("eclat delete-volume",
+ generic_parse_options(env->cmd,
"delete a EC2 volume",
argc, argv, &i);
argc -= i;
diff --git a/src/setiattr.c b/src/setiattr.c
index c84345f..decfcbb 100644
--- a/src/setiattr.c
+++ b/src/setiattr.c
@@ -83,7 +83,7 @@ eclat_modify_instance_attribute(eclat_command_env_t *env, int argc, char **argv)
generic_proginfo->args_doc = "INST-ID ATTR VALUE [VALUE...]";
generic_proginfo->print_help_hook = list_mod_attrs;
- generic_parse_options("eclat modify-instance-attribute",
+ generic_parse_options(env->cmd,
"modify the attribute of an instance",
argc, argv, &i);
argv += i;
diff --git a/src/startstop.c b/src/startstop.c
index 216ee1c..7ffb5bb 100644
--- a/src/startstop.c
+++ b/src/startstop.c
@@ -17,11 +17,12 @@
#include "eclat.h"
static void
-parse_options(const char *progname, const char *docstring,
+parse_options(struct eclat_command const *env,
+ const char *docstring,
int argc, char *argv[], int *index)
{
generic_proginfo->args_doc = "ID [ID...]";
- return generic_parse_options(progname, docstring, argc, argv, index);
+ return generic_parse_options(env, docstring, argc, argv, index);
}
static int
@@ -52,7 +53,7 @@ eclat_start_instance(eclat_command_env_t *env, int argc, char **argv)
{
int i;
- parse_options("eclat start-instances",
+ parse_options(env->cmd,
"Start named instances",
argc, argv, &i);
@@ -65,7 +66,7 @@ eclat_stop_instance(eclat_command_env_t *env, int argc, char **argv)
{
int i;
- parse_options("eclat stop-instances",
+ parse_options(env->cmd,
"Stop named instances",
argc, argv, &i);
@@ -78,7 +79,7 @@ eclat_reboot_instance(eclat_command_env_t *env, int argc, char **argv)
{
int i;
- parse_options("eclat reboot-instances",
+ parse_options(env->cmd,
"Reboot named instances",
argc, argv, &i);
diff --git a/src/util.c b/src/util.c
index 22696d9..65b8385 100644
--- a/src/util.c
+++ b/src/util.c
@@ -27,7 +27,7 @@ translate_ids(int argc, char **argv, const char *mapname)
int i;
struct eclat_map *map;
char *val;
- char *p, *q, *realname;
+ char *q, *realname;
int dir;
if (!translate_option || argc == 0)

Return to:

Send suggestions and report system problems to the System administrator.