MCPcopy Create free account
hub / github.com/ipython/traitlets / increment_argcomplete_index

Function increment_argcomplete_index

traitlets/config/argcomplete_config.py:64–78  ·  view source on GitHub ↗

Assumes ``$_ARGCOMPLETE`` is set and `argcomplete` is importable Increment the index pointed to by ``$_ARGCOMPLETE``, which is used to determine which word `argcomplete` should start evaluating the command-line. This may be useful to "inform" `argcomplete` that we have already evaluated

()

Source from the content-addressed store, hash-verified

62
63
64def increment_argcomplete_index() -> None:
65 """Assumes ``$_ARGCOMPLETE`` is set and `argcomplete` is importable
66
67 Increment the index pointed to by ``$_ARGCOMPLETE``, which is used to
68 determine which word `argcomplete` should start evaluating the command-line.
69 This may be useful to "inform" `argcomplete` that we have already evaluated
70 the first word as a subcommand.
71 """
72 try:
73 os.environ["_ARGCOMPLETE"] = str(int(os.environ["_ARGCOMPLETE"]) + 1)
74 except Exception:
75 try:
76 argcomplete.debug("Unable to increment $_ARGCOMPLETE", os.environ["_ARGCOMPLETE"]) # type:ignore[attr-defined,no-untyped-call]
77 except (KeyError, ModuleNotFoundError):
78 pass
79
80
81class ExtendedCompletionFinder(CompletionFinder):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…