File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 elif isinstance (v, basestring ):
1717 v = ' "%s "' % v
1818 elif isinstance (v, list ):
19- v = ' vec![%s ]' % ' ,' .join(' UploadProtocol:: %s ' % p.capitalize() for p in v)
19+ v = ' vec![%s ]' % ' ,' .join(' " %s " ' % p for p in v)
2020 return ' Some(%s )' % v
2121%> \
2222<%def name = "grammar(c ) "> \
@@ -182,13 +182,11 @@ let arg_data = [
182182
183183 if mc.media_params:
184184 upload_protocols = [mp.protocol for mp in mc.media_params]
185- # TODO : figure out how to have a group of arguments
186- # NOTE : use possible_values() to specify 'mode'
187185 args.append((
188186 UPLOAD_FLAG ,
189187 " Specify which file to upload" ,
190188 " mode" ,
191- True ,
189+ False ,
192190 False ,
193191 upload_protocols
194192 ))
@@ -266,7 +264,20 @@ for &(main_command_name, ref subcommands) in &arg_data {
266264 arg = arg.multiple(multi);
267265 }
268266 if let &Some(ref protocols) = protocols {
269-
267+ arg = arg.possible_values(protocols.clone());
268+ arg = arg.requires("file");
269+ arg = arg.requires("mime");
270+
271+ scmd = scmd.arg(Arg::with_name("file")
272+ .short("f")
273+ .required(false)
274+ .help("The file to upload")
275+ .takes_value(true));
276+ scmd = scmd.arg(Arg::with_name("mime")
277+ .short("m")
278+ .required(false)
279+ .help("The file's mime time, like 'application/octet-stream'")
280+ .takes_value(true));
270281 }
271282 scmd = scmd.arg(arg);
272283 }
You can’t perform that action at this time.
0 commit comments