55 ADD_SCOPE_FN , TREF )
66 from cli import (mangle_subcommand, new_method_context, PARAM_FLAG , STRUCT_FLAG , UPLOAD_FLAG , OUTPUT_FLAG , VALUE_ARG ,
77 CONFIG_DIR , SCOPE_FLAG , is_request_value_property, FIELD_SEP , docopt_mode, FILE_ARG , MIME_ARG , OUT_ARG ,
8- call_method_ident, arg_ident, POD_TYPES , opt_value, ident, JSON_TYPE_VALUE_MAP ,
8+ call_method_ident, POD_TYPES , opt_value, ident, JSON_TYPE_VALUE_MAP ,
99 KEY_VALUE_ARG , to_cli_schema, SchemaEntry, CTYPE_POD , actual_json_type, CTYPE_MAP , CTYPE_ARRAY ,
10- application_secret_path, DEBUG_FLAG , DEBUG_AUTH_FLAG , CONFIG_DIR_FLAG )
10+ application_secret_path, DEBUG_FLAG , DEBUG_AUTH_FLAG , CONFIG_DIR_FLAG , req_value, MODE_ARG )
1111
1212 v_arg = ' <%s >' % VALUE_ARG
1313 SOPT = ' self.opt'
@@ -172,7 +172,7 @@ ${self._request_value_impl(c, request_cli_schema, prop_name, request_prop_type)}
172172 % elif p.type != ' string' :
173173 % if p.get(' repeated' , False ):
174174let ${ prop_name} : Vec<${ prop_type} = Vec::new();
175- for (arg_id, arg) in opt.values_of().unwrap_or(Vec::new()).iter().enumerate() {
175+ for (arg_id, arg) in opt.values_of(" ${ mangle_subcommand(p.name) } " ).unwrap_or(Vec::new()).iter().enumerate() {
176176 ${ prop_name} .push(arg_from_str(&arg, err, "<${ mangle_subcommand(p.name)} >", arg_id), "${ p.type} "));
177177}
178178 % else :
@@ -197,7 +197,7 @@ let mut download_mode = false;
197197% endif
198198let mut call = self.hub.${ mangle_ident(resource)} ().${ mangle_ident(method)} (${ ' , ' .join(call_args)} );
199199% if handle_props:
200- for parg in opt.values_of("${ ident( VALUE_ARG ) } ").unwrap_or(Vec::new()).iter() {
200+ for parg in opt.values_of("${ VALUE_ARG } ").unwrap_or(Vec::new()).iter() {
201201 let (key, value) = parse_kv_arg(& *parg, err, false);
202202 match key {
203203% for p in optional_props:
@@ -253,21 +253,9 @@ ${value_unwrap}\
253253}
254254% endif # handle call parameters
255255% if mc.media_params:
256- let protocol =
257- % for p in mc.media_params:
258- % if loop.first:
259- if \
260- % else :
261- } else if \
262- % endif
263- ${ opt_value(p.protocol)} {
264- "${ p.protocol} "
265- % endfor # each media param
266- } else {
267- unreachable!()
268- };
269- let mut input_file = input_file_from_opts(& ${ opt_value(FILE_ARG )} , err);
270- let mime_type = input_mime_from_opts(& ${ opt_value(MIME_ARG )} , err);
256+ let protocol = ${ req_value(MODE_ARG )} ;
257+ let mut input_file = input_file_from_opts(${ req_value(FILE_ARG )} , err);
258+ let mime_type = input_mime_from_opts(${ req_value(MIME_ARG )} , err);
271259% else :
272260let protocol = "${ STANDARD } ";
273261% endif # support upload
@@ -376,7 +364,7 @@ if dry_run {
376364%> \
377365let mut ${ request_prop_name} = api::${ request_prop_type} ::default();
378366let mut field_cursor = FieldCursor::default();
379- for kvarg in ${ opt_value( KEY_VALUE_ARG ) } .iter() {
367+ for kvarg in opt.values_of(" ${ KEY_VALUE_ARG } ").unwrap_or(Vec::new()) .iter() {
380368 let last_errc = err.issues.len();
381369 let (key, value) = parse_kv_arg(& *kvarg, err, false);
382370 let mut temp_cursor = field_cursor.clone();
0 commit comments