MCPcopy Create free account
hub / github.com/Textualize/trogon / to_cli_string

Method to_cli_string

trogon/run_command.py:221–238  ·  view source on GitHub ↗

Generates a string representing the CLI invocation as if typed directly into the command line. Returns: A string representing the command invocation.

(self, include_root_command: bool = False)

Source from the content-addressed store, hash-verified

219 return args
220
221 def to_cli_string(self, include_root_command: bool = False) -> Text:
222 """
223 Generates a string representing the CLI invocation as if typed directly into the
224 command line.
225
226 Returns:
227 A string representing the command invocation.
228 """
229 args = self.to_cli_args(include_root_command=include_root_command)
230
231 text_renderables: list[Text] = []
232 for arg in args:
233 text_renderables.append(
234 Text(shlex.quote(str(arg)))
235 if arg != ValueNotSupplied()
236 else Text("???", style="bold black on red")
237 )
238 return Text(" ").join(text_renderables)

Calls 2

to_cli_argsMethod · 0.95
ValueNotSuppliedClass · 0.90