MCPcopy
hub / github.com/pallets/click / parse_args

Method parse_args

src/click/parser.py:298–314  ·  view source on GitHub ↗

Parses positional arguments and returns ``(values, args, order)`` for the parsed options and arguments as well as the leftover arguments if there are any. The order is a list of objects as they appear on the command line. If arguments appear multiple times they will

(
        self, args: list[str]
    )

Source from the content-addressed store, hash-verified

296 self._args.append(_Argument(obj, dest=dest, nargs=nargs))
297
298 def parse_args(
299 self, args: list[str]
300 ) -> tuple[dict[str, t.Any], list[str], list[CoreParameter]]:
301 """Parses positional arguments and returns ``(values, args, order)``
302 for the parsed options and arguments as well as the leftover
303 arguments if there are any. The order is a list of objects as they
304 appear on the command line. If arguments appear multiple times they
305 will be memorized multiple times as well.
306 """
307 state = _ParsingState(args)
308 try:
309 self._process_args_for_options(state)
310 self._process_args_for_args(state)
311 except UsageError:
312 if self.ctx is None or not self.ctx.resilient_parsing:
313 raise
314 return state.opts, state.largs, state.order
315
316 def _process_args_for_args(self, state: _ParsingState) -> None:
317 pargs, args = _unpack_args(

Callers

nothing calls this directly

Calls 3

_ParsingStateClass · 0.85

Tested by

no test coverage detected