bitpay/node-bitpay-client — pull request #29 by imrehg (2014-07-12 07:08:23+00:00)
Title: bitpay-cli: email is only required for login command

Move the "-e|--email" option to the "login" command since no other
command requires it.

A tricky part is to get the option values out of the commander library.
Apparently top level ("program" options) are accessed through the
program's name (here e.g. "bitpay.optionname"), while command-specific
options are passed to the .action function (in this patch e.g.
"env.optionname"). This means one has to be mindful whether an option
is global (accessible all through the "program") or just within the option
and retrieve the option value accordingly.

Also changed "[email]" to "", meaning that the email value is a
required parameter of "-e|--email" option (ie. "bitpay login -e" is not
a valid command when using "" in the settings, while it would be
valid using the previous "[email]" form. This affects the other options
as well, but that's beyond the scope of this patch.

Unfortunately as I see commander does not allow (yet) for making flags
required (i.e. to make it invalid to call "bitpay login" without "-e"),
so internal checks are still needed. See more at the upstream issue
tracker of visionmedia/commander.js/issues/44

Patch is also related to #25.

Signed-off-by: Gergely Imreh