:py:mod:`mloq.config.custom_click` ================================== .. py:module:: mloq.config.custom_click .. autoapi-nested-parse:: This is mostly a copy paste from https://github.com/pallets/click/blob/2fc486c880eda9fdb746ed8baa49416acab9ea6d/src/click/termui.py Modified to allow prompt input that has a different color than the prompt text, while keeping the color of the default prompt values the same as the prompt text color. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: mloq.config.custom_click.hidden_prompt_func mloq.config.custom_click._build_prompt mloq.config.custom_click._format_default mloq.config.custom_click.prompt mloq.config.custom_click.confirm Attributes ~~~~~~~~~~ .. autoapisummary:: mloq.config.custom_click.visible_prompt_func mloq.config.custom_click._ansi_reset_all .. py:data:: visible_prompt_func .. py:data:: _ansi_reset_all :annotation: =  .. py:function:: hidden_prompt_func(prompt) Input hidden text from the user. .. py:function:: _build_prompt(text, suffix, show_default=False, default=None, show_choices=True, type=None) .. py:function:: _format_default(default) .. py:function:: prompt(text, default=None, hide_input=False, confirmation_prompt=False, type=None, value_proc=None, prompt_suffix=': ', show_default=True, err=False, show_choices=True) Prompts a user for input. This is a convenience function that can be used to prompt a user for input later. If the user aborts the input by sending a interrupt signal, this function will catch it and raise a :exc:`Abort` exception. .. versionadded:: 7.0 Added the show_choices parameter. .. versionadded:: 6.0 Added unicode support for cmd.exe on Windows. .. versionadded:: 4.0 Added the `err` parameter. :param text: the text to show for the prompt. :param default: the default value to use if no input happens. If this is not given it will prompt until it's aborted. :param hide_input: if this is set to true then the input value will be hidden. :param confirmation_prompt: asks for confirmation for the value. :param type: the type to use to check the value against. :param value_proc: if this parameter is provided it's a function that is invoked instead of the type conversion to convert a value. :param prompt_suffix: a suffix that should be added to the prompt. :param show_default: shows or hides the default value in the prompt. :param err: if set to true the file defaults to ``stderr`` instead of ``stdout``, the same as with echo. :param show_choices: Show or hide choices if the passed type is a Choice. For example if type is a Choice of either day or week, show_choices is true and text is "Group by" then the prompt will be "Group by (day, week): ". :return: None .. py:function:: confirm(text, default=False, abort=False, prompt_suffix=': ', show_default=True, err=False) Prompts for confirmation (yes/no question). If the user aborts the input by sending a interrupt signal this function will catch it and raise a :exc:`Abort` exception. .. versionadded:: 4.0 Added the `err` parameter. :param text: the question to ask. :param default: the default for the prompt. :param abort: if this is set to `True` a negative answer aborts the exception by raising :exc:`Abort`. :param prompt_suffix: a suffix that should be added to the prompt. :param show_default: shows or hides the default value in the prompt. :param err: if set to true the file defaults to ``stderr`` instead of ``stdout``, the same as with echo. :return: User's decision.