cleo API reference
80 public APIs from cleo (python-poetry/cleo) — 24 classes, 4 functions, 52 methods. Signatures extracted by static analysis of the actual source.
Repository: python-poetry/cleo
| Kind | Count |
|---|---|
| Classes | 24 |
| Functions | 4 |
| Methods | 52 |
API list
func
src.cleo._utils.find_similar_names(name:str, names:list[str]) -> list[str]Finds names similar to a given command name.
func
src.cleo._utils.wcswidth(s:str) -> intDetermine how many columns are needed to display a string in a terminal.
func
src.cleo._utils.wcwidth(c:str) -> intDetermine how many columns are needed to display a character in a terminal.
method
src.cleo.commands.command.Command.add_style(name:str, fg:str | None=None, bg:str | None=None, options:list[str] | None=None) -> NoneAdds a new style
method
src.cleo.commands.command.Command.argument(name:str) -> AnyGet the value of a command argument.
method
src.cleo.commands.command.Command.ask(question:str | Question, default:Any | None=None) -> AnyPrompt the user for input.
method
src.cleo.commands.command.Command.call(name:str, args:str | None=None) -> intCall another command.
method
src.cleo.commands.command.Command.call_silent(name:str, args:str | None=None) -> intCall another command silently.
method
src.cleo.commands.command.Command.comment(text:str) -> NoneWrite a string as comment output.
method
src.cleo.commands.command.Command.confirm(question:str, default:bool=False, true_answer_regex:str='(?i)^y') -> boolConfirm a question with the user.
method
src.cleo.commands.command.Command.create_question(question:str, type:Literal['choice', 'confirmation'] | None=None, **kwargs:Any) -> QuestionReturns a Question of specified type.
method
src.cleo.commands.command.Command.handle() -> intExecute the command.
method
src.cleo.commands.command.Command.info(text:str) -> NoneWrite a string as information output.
method
src.cleo.commands.command.Command.interact(io:IO) -> NoneInteracts with the user.
method
src.cleo.commands.command.Command.line(text:str, style:str | None=None, verbosity:Verbosity=Verbosity.NORMAL) -> NoneWrite a string as information output.
method
src.cleo.commands.command.Command.line_error(text:str, style:str | None=None, verbosity:Verbosity=Verbosity.NORMAL) -> NoneWrite a string as information output to stderr.
method
src.cleo.commands.command.Command.option(name:str) -> AnyGet the value of a command option.
method
src.cleo.commands.command.Command.overwrite(text:str) -> NoneOverwrites the current line.
method
src.cleo.commands.command.Command.progress_bar(max:int=0) -> ProgressBarCreates a new progress bar
method
src.cleo.commands.command.Command.progress_indicator(fmt:str | None=None, interval:int=100, values:list[str] | None=None) -> ProgressIndicatorCreates a new progress indicator.
method
src.cleo.commands.command.Command.question(text:str) -> NoneWrite a string as question output.
method
src.cleo.commands.command.Command.render_table(headers:str, rows:Rows, style:str | None=None) -> NoneFormat input to textual table.
method
src.cleo.commands.command.Command.table(header:str | None=None, rows:Rows | None=None, style:str | None=None) -> TableReturn a Table instance.
method
src.cleo.commands.command.Command.table_separator() -> TableSeparatorReturn a TableSeparator instance.
method
src.cleo.commands.command.Command.write(text:str, style:str | None=None) -> NoneWrites a string without a new line.
method
src.cleo.cursor.Cursor.clear_line() -> CursorClears all the output from the current line.
method
src.cleo.cursor.Cursor.clear_screen() -> CursorClears the entire screen.
class
src.cleo.events.console_command_event.ConsoleCommandEventAn event triggered before the command is executed.
class
src.cleo.events.console_event.ConsoleEventAn event that gives access to the IO of a command.
class
src.cleo.events.console_signal_event.ConsoleSignalEventAn event triggered by a system signal.
class
src.cleo.events.event.EventEvent
class
src.cleo.exceptions.CleoCommandNotFoundErrorRaised when called command does not exist.
class
src.cleo.exceptions.CleoErrorBase Cleo exception.
class
src.cleo.exceptions.CleoNamespaceNotFoundErrorRaised when called namespace has no commands.
class
src.cleo.exceptions.CleoNoSuchOptionErrorRaised when command does not have given option.
class
src.cleo.exceptions.CleoUserErrorBase exception for user errors.
class
src.cleo.exceptions.CleoValueErrorRaised when wrong value was given to Cleo components.
method
src.cleo.formatters.formatter.Formatter.escape(text:str) -> strEscapes "<" special char in given text.
method
src.cleo.formatters.formatter.Formatter.escape_trailing_backslash(text:str) -> strEscapes trailing "\" in given text.
func
src.cleo.helpers.tokenize(string:str) -> list[str]Split the string using shell-like syntax.
class
src.cleo.io.inputs.argument.ArgumentA command line argument.
class
src.cleo.io.inputs.argv_input.ArgvInputRepresents an input coming from the command line.
class
src.cleo.io.inputs.input.InputThis class is the base class for concrete Input implementations.
method
src.cleo.io.inputs.input.Input.close() -> NoneCloses the input.
method
src.cleo.io.inputs.input.Input.is_closed() -> boolReturns whether the input is closed.
method
src.cleo.io.inputs.input.Input.parameter_option(values:str | list[str], default:Any=False, only_params:bool=False) -> AnyReturns the value of a raw option (not parsed).
method
src.cleo.io.inputs.input.Input.read(length:int, default:str='') -> strReads the given amount of characters from the input stream.
method
src.cleo.io.inputs.input.Input.read_line(length:int=-1, default:str='') -> strReads a line from the input stream.
class
src.cleo.io.inputs.option.OptionA command line option.
class
src.cleo.io.inputs.string_input.StringInputRepresents an input provided as a string
class
src.cleo.testers.application_tester.ApplicationTesterEases the testing of console applications.
method
src.cleo.testers.application_tester.ApplicationTester.execute(args:str='', inputs:str | None=None, interactive:bool=True, verbosity:Verbosity | None=None, decorated:bool=False, supports_utf8:bool=True) -> intExecutes the command
class
src.cleo.testers.command_tester.CommandTesterEases the testing of console commands.
method
src.cleo.testers.command_tester.CommandTester.execute(args:str='', inputs:str | None=None, interactive:bool | None=None, verbosity:Verbosity | None=None, decorated:bool | None=None, supports_utf8:bool=True) -> intExecutes the command
class
src.cleo.ui.choice_question.ChoiceQuestionMultiple choice question.
class
src.cleo.ui.confirmation_question.ConfirmationQuestionRepresents a yes/no question.
class
src.cleo.ui.exception_trace.component.ExceptionTraceRenders the trace of an exception.
class
src.cleo.ui.progress_bar.ProgressBarThe ProgressBar provides helpers to display progress output.
method
src.cleo.ui.progress_bar.ProgressBar.advance(step:int=1) -> NoneAdvances the progress output X steps.
method
src.cleo.ui.progress_bar.ProgressBar.clear() -> NoneRemoves the progress bar from the current line.
method
src.cleo.ui.progress_bar.ProgressBar.display() -> NoneOutput the current progress string.
method
src.cleo.ui.progress_bar.ProgressBar.finish() -> NoneFinish the progress output.
method
src.cleo.ui.progress_bar.ProgressBar.set_progress(step:int) -> NoneSets the current progress.
method
src.cleo.ui.progress_bar.ProgressBar.start(max:int | None=None) -> NoneStart the progress output.
class
src.cleo.ui.progress_indicator.ProgressIndicatorA process indicator.
method
src.cleo.ui.progress_indicator.ProgressIndicator.auto(start_message:str, end_message:str) -> Iterator[ProgressIndicator]Auto progress.
class
src.cleo.ui.question.QuestionA question that will be asked in a Console.
method
src.cleo.ui.question.Question.ask(io:IO) -> AnyAsks the question to the user.
class
src.cleo.ui.table_style.TableStyleDefines styles for Table instances.
method
src.cleo.ui.table_style.TableStyle.set_border_format(border_format:str) -> TableStyleSets the border format.
method
src.cleo.ui.table_style.TableStyle.set_cell_header_format(cell_header_format:str) -> TableStyleSets the header cell format.
method
src.cleo.ui.table_style.TableStyle.set_cell_row_content_format(cell_row_content_format:str) -> TableStyleSets the row cell content format.
method
src.cleo.ui.table_style.TableStyle.set_cell_row_format(cell_row_format:str) -> TableStyleSets the row cell format.
method
src.cleo.ui.table_style.TableStyle.set_default_crossing_char(char:str) -> TableStyleSets default crossing character used for each cross.
method
src.cleo.ui.table_style.TableStyle.set_footer_title_format(footer_title_format:str) -> TableStyleSets the footer title format.
method
src.cleo.ui.table_style.TableStyle.set_header_title_format(header_title_format:str) -> TableStyleSets the header title format.
method
src.cleo.ui.table_style.TableStyle.set_horizontal_border_chars(outside:str, inside:str | None=None) -> TableStyleSets horizontal border characters.
method
src.cleo.ui.table_style.TableStyle.set_pad_type(pad_type:str) -> TableStyleSets the padding type.
method
src.cleo.ui.table_style.TableStyle.set_padding_char(padding_char:str) -> TableStyleSets padding character, used for cell padding.
method
src.cleo.ui.table_style.TableStyle.set_vertical_border_chars(outside:str, inside:str | None=None) -> TableStyleSets vertical border characters.
About this data
These signatures were extracted from the public source of python-poetry/cleo
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.