docs(clap): update STRUCT_FLAG and UPLOAD flags

* adjust documentation to resemble actual upload flag semantics. It was
  still using the one previously used in docopt.
* Make -m <mime-type> optional, defaulting to 'application/octet-stream'

Should have been fixed alongside of #81
This commit is contained in:
Sebastian Thiel
2015-04-30 13:34:56 +02:00
parent cc1bfd19c8
commit bd27046cc8
4 changed files with 24 additions and 21 deletions

View File

@@ -44,7 +44,7 @@ ${util.program_name()} [options]
if mc.media_params:
upload_protocols = [mp.protocol for mp in mc.media_params]
mode = docopt_mode(upload_protocols)
args.append('(-%s %s -%s <%s> -%s <%s>)' % (UPLOAD_FLAG, mode, FILE_FLAG, FILE_ARG, MIME_FLAG, MIME_ARG))
args.append('(-%s %s -%s <%s> [-%s <%s>])' % (UPLOAD_FLAG, mode, FILE_FLAG, FILE_ARG, MIME_FLAG, MIME_ARG))
# end upload handling
if mc.optional_props or parameters is not UNDEFINED:
@@ -287,7 +287,6 @@ for &(main_command_name, ref subcommands) in arg_data.iter() {
if let &Some(ref protocols) = protocols {
arg = arg.possible_values(protocols);
arg = arg.requires("${FILE_ARG}");
arg = arg.requires("${MIME_ARG}");
scmd = scmd.arg(Arg::with_name("${FILE_ARG}")
.short("${FILE_FLAG}")
@@ -298,7 +297,8 @@ for &(main_command_name, ref subcommands) in arg_data.iter() {
scmd = scmd.arg(Arg::with_name("${MIME_ARG}")
.short("${MIME_FLAG}")
.requires("${MODE_ARG}")
.required(true)
.requires("${FILE_ARG}")
.required(false)
.help("The file's mime time, like 'application/octet-stream'")
.takes_value(true));
}