Metavar not used for store_true

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix up ArgumentParser instantiation for version handling

Argparse treats version like an argument instead of a parameter to the
object, but then we set version= in the new argument.

Signed-off-by: Andy Grover <agrover@redhat.com>
Cmdline.cli() returns a single object, not two, now

Replace all usages of self.options with self.args.

Remove the one prior usage of self.args, (check for extras),
not longer applicable.

Signed-off-by: Andy Grover <agrover@redhat.com>
Fixup plugin-info argument

It's a command, so it should store instead of store_true

Set a metavar.

Signed-off-by: Andy Grover <agrover@redhat.com>
ArgParser doesn't need usage set

It generates the usage line from the parser's data.

Signed-off-by: Andy Grover <agrover@redhat.com>
Improve readability of -b's help text

Sounds like another sentence, so make it one?

Signed-off-by: Andy Grover <agrover@redhat.com>
Use Argparse subcommands for commands

Put all info on commands into a "cmds" data structure, and then use that
to register subcommands for everything.

Set self.func to the function we should call based upon the convention
that the method is named the same as the command, but perhaps with '_'s
instead of '-'s. This required some methods to be renamed to match.

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove stuff we don't need any more

All command args are now associated with their applicable subcommand.

_cmds, and _validate should no longer be needed to validate input.

Signed-off-by: Andy Grover <agrover@redhat.com>
Change stuff to use new parsing and method calling style

All functions associated with subcommands take (self, args).
Instead of these functions looking at self.cmd_value and self.args,
all arguments are in args parameter.

cli() is made into a member method.

Signed-off-by: Andy Grover <agrover@redhat.com>
Make _get_item throw an ArgError if id not found

Since every caller was checking the return value and then throwing the
exception if None, we can just throw from _get_item and save some code.

We also add a friendly_name parameter so we can have a customized exception
message.

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove unneeded documentation of what "self" param is

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix up replicate_volume_range

Clarified some logic that might be confusing. Raise an exception if
argument counts don't match. Flag arguments as 'append'.

Signed-off-by: Andy Grover <agrover@redhat.com>
Customize --help output

Unless we give add_subparser a metavar, it uses a concatenation of all
subcommands, which is not attractive. Other parameters don't seem to be
needed so remove them, and put the description for the main parser
in the instantiation instead of afterwards.

Signed-off-by: Andy Grover <agrover@redhat.com>
Allow both upper and lowercase for types

Because we're on Unix and should allow lowercase if possible.

Improve the command list walking to pass kwargs more easily.

Signed-off-by: Andy Grover <agrover@redhat.com>