MCPcopy Index your code
hub / github.com/aws/aws-cli / _remove_subcommand

Method _remove_subcommand

awscli/argparser.py:232–254  ·  view source on GitHub ↗
(self, args, parsed_args)

Source from the content-addressed store, hash-verified

230 return None
231
232 def _remove_subcommand(self, args, parsed_args):
233 # We want to remove only the subcommand from the args list
234 # and keep everything else. We should be safe to remove
235 # the first argument that matches the subcommand name.
236 #
237 # .parse_known_args() assumes that any args that it doesn't
238 # understand do not consume any values. For example:
239 #
240 # aws ecs --cluster mycluster describe-tasks --tasks foo
241 #
242 # is not a valid command, because we ignore `--cluster`
243 # and assume that `mycluster` is a subcommand.
244 #
245 # However, this command works:
246 #
247 # aws ecs --cluster=mycluster desribe-tasks --tasks foo
248 #
249 # Therefore we don't have to worry about the case where
250 # a param *value* shadows the parsed subcommand because
251 # the existing parser would have already errored out.
252 new_args = args[:]
253 new_args.remove(parsed_args.subcommand)
254 return new_args
255
256 def _build(self, argument_table, command_table):
257 # In order to check for a subcommand while still respecting

Callers 1

parse_known_argsMethod · 0.95

Calls 1

removeMethod · 0.45

Tested by

no test coverage detected