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

Method __call__

awscli/customizations/commands.py:135–211  ·  view source on GitHub ↗
(self, args, parsed_globals)

Source from the content-addressed store, hash-verified

133 return None
134
135 def __call__(self, args, parsed_globals):
136 # args is the remaining unparsed args.
137 # We might be able to parse these args so we need to create
138 # an arg parser and parse them.
139 self._subcommand_table = self._build_subcommand_table()
140 self._arg_table = self._build_arg_table()
141 event = f'before-building-argument-table-parser.{".".join(self.lineage_names)}'
142 self._session.emit(
143 event,
144 argument_table=self._arg_table,
145 args=args,
146 session=self._session,
147 )
148 maybe_parsed_subcommand = self._parse_potential_subcommand(
149 args, self._subcommand_table
150 )
151 if maybe_parsed_subcommand is not None:
152 new_args, subcommand_name = maybe_parsed_subcommand
153 return self._subcommand_table[subcommand_name](
154 new_args, parsed_globals
155 )
156 parser = ArgTableArgParser(self.arg_table, self.subcommand_table)
157 parsed_args, remaining = parser.parse_known_args(args)
158
159 # Unpack arguments
160 for key, value in vars(parsed_args).items():
161 cli_argument = None
162
163 # Convert the name to use dashes instead of underscore
164 # as these are how the parameters are stored in the
165 # `arg_table`.
166 xformed = key.replace('_', '-')
167 if xformed in self.arg_table:
168 cli_argument = self.arg_table[xformed]
169
170 value = unpack_argument(
171 self._session, 'custom', self.name, cli_argument, value
172 )
173
174 # If this parameter has a schema defined, then allow plugins
175 # a chance to process and override its value.
176 if self._should_allow_plugins_override(cli_argument, value):
177 override = self._session.emit_first_non_none_response(
178 f'process-cli-arg.custom.{self.name}',
179 cli_argument=cli_argument,
180 value=value,
181 operation=None,
182 )
183
184 if override is not None:
185 # A plugin supplied a conversion
186 value = override
187 else:
188 # Unpack the argument, which is a string, into the
189 # correct Python type (dict, list, etc)
190 value = unpack_cli_arg(cli_argument, value)
191 self._validate_value_against_schema(
192 cli_argument.argument_model, value

Callers

nothing calls this directly

Calls 15

_build_arg_tableMethod · 0.95
parse_known_argsMethod · 0.95
_display_helpMethod · 0.95
_run_mainMethod · 0.95
ArgTableArgParserClass · 0.90
unpack_argumentFunction · 0.90
unpack_cli_argFunction · 0.90

Tested by

no test coverage detected