MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / Completions

Class Completions

cmd2/completion.py:279–314  ·  view source on GitHub ↗

The results of a completion operation.

Source from the content-addressed store, hash-verified

277
278@dataclass(frozen=True, slots=True, kw_only=True)
279class Completions(CompletionResultsBase):
280 """The results of a completion operation."""
281
282 # Optional hint which prints above completion suggestions
283 hint: str = ""
284
285 # Optional message to display if an error occurs during completion
286 error: str = ""
287
288 # Optional Rich table which provides more context for the data being completed
289 table: Table | None = None
290
291 # If True, the completion engine is allowed to finalize a completion
292 # when a single match is found by appending a trailing space and
293 # closing any open quotation marks.
294 #
295 # Set this to False for intermediate or hierarchical matches (such as
296 # directories) where the user needs to continue typing the next segment.
297 # This flag is ignored if there are multiple matches.
298 allow_finalization: bool = True
299
300 #####################################################################
301 # The following fields are used internally by cmd2 to handle
302 # automatic quoting and are not intended for user modification.
303 #####################################################################
304
305 # Whether to add an opening quote to the matches.
306 _add_opening_quote: bool = False
307
308 # The starting index of the user-provided search text within a full match.
309 # This accounts for leading shortcuts (e.g., in '?cmd', the offset is 1).
310 # Used to ensure opening quotes are inserted after the shortcut rather than before it.
311 _search_text_offset: int = 0
312
313 # The quote character to use if adding an opening or closing quote to the matches.
314 _quote_char: str = ""

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…