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

Function _is_incomplete_option

src/click/shell_completion.py:575–597  ·  view source on GitHub ↗

Determine if the given parameter is an option that needs a value. :param args: List of complete args before the incomplete value. :param param: Option object being checked.

(ctx: Context, args: list[str], param: Parameter)

Source from the content-addressed store, hash-verified

573
574
575def _is_incomplete_option(ctx: Context, args: list[str], param: Parameter) -> bool:
576 """Determine if the given parameter is an option that needs a value.
577
578 :param args: List of complete args before the incomplete value.
579 :param param: Option object being checked.
580 """
581 if not isinstance(param, Option):
582 return False
583
584 if param.is_flag or param.count:
585 return False
586
587 last_option = None
588
589 for index, arg in enumerate(reversed(args)):
590 if index + 1 > param.nargs:
591 break
592
593 if _start_of_option(ctx, arg):
594 last_option = arg
595 break
596
597 return last_option is not None and last_option in param.opts
598
599
600def _resolve_context(

Callers 1

_resolve_incompleteFunction · 0.85

Calls 1

_start_of_optionFunction · 0.85

Tested by

no test coverage detected