{"owner":"pallets","repo":"click","hasSkills":true,"totalSkillsCount":2,"totalTokensCount":2396,"categories":["root-instruction","project-spec"],"hasMcp":false,"mcpConfig":null,"found":["docs/prompts.md","docs/api.md"],"skills":{"docs/prompts.md":"# User Input Prompts\n\n```{currentmodule} click\n```\n\nClick supports prompts in two different places. The first is automated prompts when the parameter handling happens, and\nthe second is to ask for prompts at a later point independently.\n\nThis can be accomplished with the {func}`prompt` function, which asks for valid input according to a type, or the\n{func}`confirm` function, which asks for confirmation (yes/no).\n\n```{contents}\n---\ndepth: 2\nlocal: true\n---\n```\n\n(option-prompting)=\n\n## Option Prompts\n\nOption prompts are integrated into the option interface. Internally, it automatically calls either {func}`prompt` or\n{func}`confirm` as necessary.\n\nIn some cases, you want parameters that can be provided from the command line, but if not provided, ask for user input\ninstead. This can be implemented with Click by defining a prompt string.\n\nExample:\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt=True)\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\nAnd what it looks like:\n\n.. click:run::\n\n    invoke(hello, args=['--name=John'])\n    invoke(hello, input=['John'])\n```\n\nIf you are not happy with the default prompt string, you can ask for\na different one:\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt='Your name please')\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\nWhat it looks like:\n\n.. click:run::\n\n    invoke(hello, input=['John'])\n```\n\nIt is advised that prompt not be used in conjunction with the multiple flag set to True. Instead, prompt in the function\ninteractively.\n\nBy default, the user will be prompted for an input if one was not passed through the command line. To turn this behavior\noff, see {ref}`optional-value`.\n\n## Input Prompts\n\nTo manually ask for user input, you can use the {func}`prompt` function. By default, it accepts any Unicode string, but\nyou can ask for any other type. For instance, you can ask for a valid integer:\n\n```python\nvalue = click.prompt('Please enter a valid integer', type=int)\n```\n\nAdditionally, the type will be determined automatically if a default value is provided. For instance, the following will\nonly accept floats:\n\n```python\nvalue = click.prompt('Please enter a number', default=42.0)\n```\n\n## Optional Prompts\n\nIf the option has `prompt` enabled, then setting `prompt_required=False` tells Click to only show the prompt if the\noption's flag is given, instead of if the option is not provided at all.\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt=True, prompt_required=False, default=\"Default\")\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\n.. click:run::\n\n    invoke(hello)\n    invoke(hello, args=[\"--name\", \"Value\"])\n    invoke(hello, args=[\"--name\"], input=\"Prompt\")\n```\n\nIf `required=True`, then the option will still prompt if it is not given, but it will also prompt if only the flag is\ngiven.\n\n## Confirmation Prompts\n\nTo ask if a user wants to continue with an action, the {func}`confirm` function comes in handy. By default, it returns\nthe result of the prompt as a boolean value:\n\n```python\nif click.confirm('Do you want to continue?'):\n    click.echo('Well done!')\n```\n\nThere is also the option to make the function automatically abort the execution of the program if it does not return\n`True`:\n\n```python\nclick.confirm('Do you want to continue?', abort=True)\n```\n\n## Dynamic Defaults for Prompts\n\nThe `auto_envvar_prefix` and `default_map` options for the context allow the program to read option values from the\nenvironment or a configuration file. However, this overrides the prompting mechanism, so that the user does not get the\noption to change the value interactively.\n\nIf you want to let the user configure the default value, but still be prompted if the option isn't specified on the\ncommand line, you can do so by supplying a callable as the default value. For example, to get a default from the\nenvironment:\n\n```python\nimport os\n\n@click.command()\n@click.option(\n    \"--username\", prompt=True,\n    default=lambda: os.environ.get(\"USER\", \"\")\n)\ndef hello(username):\n    click.echo(f\"Hello, {username}!\")\n```\n\nTo describe what the default value will be, set it in ``show_default``.\n\n```{eval-rst}\n.. click:example::\n\n    import os\n\n    @click.command()\n    @click.option(\n        \"--username\", prompt=True,\n        default=lambda: os.environ.get(\"USER\", \"\"),\n        show_default=\"current user\"\n    )\n    def hello(username):\n        click.echo(f\"Hello, {username}!\")\n\n.. click:run::\n\n   invoke(hello, args=[\"--help\"])\n```\n","docs/api.md":"# API\n\n```{currentmodule} click\n```\n\nThis part of the documentation lists the full API reference of all public\nclasses and functions.\n\n```{contents}\n:depth: 1\n:local: true\n```\n\n## Decorators\n\n```{eval-rst}\n.. autofunction:: command\n```\n\n```{eval-rst}\n.. autofunction:: group\n```\n\n```{eval-rst}\n.. autofunction:: argument\n```\n\n```{eval-rst}\n.. autofunction:: option\n```\n\n```{eval-rst}\n.. autofunction:: password_option\n```\n\n```{eval-rst}\n.. autofunction:: confirmation_option\n```\n\n```{eval-rst}\n.. autofunction:: version_option\n```\n\n```{eval-rst}\n.. autofunction:: custom_version_option\n```\n\n```{eval-rst}\n.. autofunction:: help_option\n```\n\n```{eval-rst}\n.. autofunction:: pass_context\n```\n\n```{eval-rst}\n.. autofunction:: pass_obj\n```\n\n```{eval-rst}\n.. autofunction:: make_pass_decorator\n```\n\n```{eval-rst}\n.. autofunction:: click.decorators.pass_meta_key\n\n```\n\n## Utilities\n\n```{eval-rst}\n.. autofunction:: echo\n```\n\n```{eval-rst}\n.. autofunction:: echo_via_pager\n```\n\n```{eval-rst}\n.. autofunction:: get_pager_file\n```\n\n```{eval-rst}\n.. autofunction:: prompt\n```\n\n```{eval-rst}\n.. autofunction:: confirm\n```\n\n```{eval-rst}\n.. autofunction:: progressbar\n```\n\n```{eval-rst}\n.. autofunction:: clear\n```\n\n```{eval-rst}\n.. autofunction:: style\n```\n\n```{eval-rst}\n.. autofunction:: unstyle\n```\n\n```{eval-rst}\n.. autofunction:: secho\n```\n\n```{eval-rst}\n.. autofunction:: edit\n```\n\n```{eval-rst}\n.. autofunction:: launch\n```\n\n```{eval-rst}\n.. autofunction:: getchar\n```\n\n```{eval-rst}\n.. autofunction:: pause\n```\n\n```{eval-rst}\n.. autofunction:: get_binary_stream\n```\n\n```{eval-rst}\n.. autofunction:: get_text_stream\n```\n\n```{eval-rst}\n.. autofunction:: open_file\n```\n\n```{eval-rst}\n.. autofunction:: get_app_dir\n```\n\n```{eval-rst}\n.. autofunction:: format_filename\n```\n\n## Commands\n\n```{eval-rst}\n.. autoclass:: BaseCommand\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Command\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: MultiCommand\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Group\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: CommandCollection\n   :members:\n```\n\n## Parameters\n\n```{eval-rst}\n.. autoclass:: Parameter\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Option\n```\n\n```{eval-rst}\n.. autoclass:: Argument\n```\n\n## Context\n\n```{eval-rst}\n.. autoclass:: Context\n   :members:\n```\n\n```{eval-rst}\n.. autofunction:: get_current_context\n```\n\n```{eval-rst}\n.. autoclass:: click.core.ParameterSource\n    :members:\n    :member-order: bysource\n```\n\n(click-api-types)=\n\n## Types\n\n```{eval-rst}\n.. autodata:: STRING\n```\n\n```{eval-rst}\n.. autodata:: INT\n```\n\n```{eval-rst}\n.. autodata:: FLOAT\n```\n\n```{eval-rst}\n.. autodata:: BOOL\n```\n\n```{eval-rst}\n.. autodata:: UUID\n```\n\n```{eval-rst}\n.. autodata:: UNPROCESSED\n```\n\n```{eval-rst}\n.. autoclass:: File\n```\n\n```{eval-rst}\n.. autoclass:: Path\n```\n\n```{eval-rst}\n.. autoclass:: Choice\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: IntRange\n```\n\n```{eval-rst}\n.. autoclass:: FloatRange\n```\n\n```{eval-rst}\n.. autoclass:: DateTime\n```\n\n```{eval-rst}\n.. autoclass:: Tuple\n```\n\n```{eval-rst}\n.. autoclass:: ParamType\n   :members:\n```\n\n## Exceptions\n\n```{eval-rst}\n.. autoexception:: ClickException\n```\n\n```{eval-rst}\n.. autoexception:: Abort\n```\n\n```{eval-rst}\n.. autoexception:: UsageError\n```\n\n```{eval-rst}\n.. autoexception:: BadParameter\n```\n\n```{eval-rst}\n.. autoexception:: FileError\n```\n\n```{eval-rst}\n.. autoexception:: NoSuchCommand\n```\n\n```{eval-rst}\n.. autoexception:: NoSuchOption\n```\n\n```{eval-rst}\n.. autoexception:: BadOptionUsage\n```\n\n```{eval-rst}\n.. autoexception:: BadArgumentUsage\n```\n\n## Formatting\n\n```{eval-rst}\n.. autoclass:: HelpFormatter\n   :members:\n```\n\n```{eval-rst}\n.. autofunction:: wrap_text\n```\n\n## Parsing\n\n```{eval-rst}\n.. autoclass:: OptionParser\n   :members:\n\n```\n\n## Shell Completion\n\nSee {doc}`/shell-completion` for information about enabling and\ncustomizing Click's shell completion system.\n\n```{eval-rst}\n.. currentmodule:: click.shell_completion\n```\n\n```{eval-rst}\n.. autoclass:: CompletionItem\n```\n\n```{eval-rst}\n.. autoclass:: ShellComplete\n    :members:\n    :member-order: bysource\n```\n\n```{eval-rst}\n.. autofunction:: add_completion_class\n\n```\n\n(testing)=\n\n## Testing\n\n```{eval-rst}\n.. currentmodule:: click.testing\n```\n\n```{eval-rst}\n.. autoclass:: CliRunner\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Result\n   :members:\n```\n"},"files":{"docs/prompts.md":"# User Input Prompts\n\n```{currentmodule} click\n```\n\nClick supports prompts in two different places. The first is automated prompts when the parameter handling happens, and\nthe second is to ask for prompts at a later point independently.\n\nThis can be accomplished with the {func}`prompt` function, which asks for valid input according to a type, or the\n{func}`confirm` function, which asks for confirmation (yes/no).\n\n```{contents}\n---\ndepth: 2\nlocal: true\n---\n```\n\n(option-prompting)=\n\n## Option Prompts\n\nOption prompts are integrated into the option interface. Internally, it automatically calls either {func}`prompt` or\n{func}`confirm` as necessary.\n\nIn some cases, you want parameters that can be provided from the command line, but if not provided, ask for user input\ninstead. This can be implemented with Click by defining a prompt string.\n\nExample:\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt=True)\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\nAnd what it looks like:\n\n.. click:run::\n\n    invoke(hello, args=['--name=John'])\n    invoke(hello, input=['John'])\n```\n\nIf you are not happy with the default prompt string, you can ask for\na different one:\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt='Your name please')\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\nWhat it looks like:\n\n.. click:run::\n\n    invoke(hello, input=['John'])\n```\n\nIt is advised that prompt not be used in conjunction with the multiple flag set to True. Instead, prompt in the function\ninteractively.\n\nBy default, the user will be prompted for an input if one was not passed through the command line. To turn this behavior\noff, see {ref}`optional-value`.\n\n## Input Prompts\n\nTo manually ask for user input, you can use the {func}`prompt` function. By default, it accepts any Unicode string, but\nyou can ask for any other type. For instance, you can ask for a valid integer:\n\n```python\nvalue = click.prompt('Please enter a valid integer', type=int)\n```\n\nAdditionally, the type will be determined automatically if a default value is provided. For instance, the following will\nonly accept floats:\n\n```python\nvalue = click.prompt('Please enter a number', default=42.0)\n```\n\n## Optional Prompts\n\nIf the option has `prompt` enabled, then setting `prompt_required=False` tells Click to only show the prompt if the\noption's flag is given, instead of if the option is not provided at all.\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt=True, prompt_required=False, default=\"Default\")\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\n.. click:run::\n\n    invoke(hello)\n    invoke(hello, args=[\"--name\", \"Value\"])\n    invoke(hello, args=[\"--name\"], input=\"Prompt\")\n```\n\nIf `required=True`, then the option will still prompt if it is not given, but it will also prompt if only the flag is\ngiven.\n\n## Confirmation Prompts\n\nTo ask if a user wants to continue with an action, the {func}`confirm` function comes in handy. By default, it returns\nthe result of the prompt as a boolean value:\n\n```python\nif click.confirm('Do you want to continue?'):\n    click.echo('Well done!')\n```\n\nThere is also the option to make the function automatically abort the execution of the program if it does not return\n`True`:\n\n```python\nclick.confirm('Do you want to continue?', abort=True)\n```\n\n## Dynamic Defaults for Prompts\n\nThe `auto_envvar_prefix` and `default_map` options for the context allow the program to read option values from the\nenvironment or a configuration file. However, this overrides the prompting mechanism, so that the user does not get the\noption to change the value interactively.\n\nIf you want to let the user configure the default value, but still be prompted if the option isn't specified on the\ncommand line, you can do so by supplying a callable as the default value. For example, to get a default from the\nenvironment:\n\n```python\nimport os\n\n@click.command()\n@click.option(\n    \"--username\", prompt=True,\n    default=lambda: os.environ.get(\"USER\", \"\")\n)\ndef hello(username):\n    click.echo(f\"Hello, {username}!\")\n```\n\nTo describe what the default value will be, set it in ``show_default``.\n\n```{eval-rst}\n.. click:example::\n\n    import os\n\n    @click.command()\n    @click.option(\n        \"--username\", prompt=True,\n        default=lambda: os.environ.get(\"USER\", \"\"),\n        show_default=\"current user\"\n    )\n    def hello(username):\n        click.echo(f\"Hello, {username}!\")\n\n.. click:run::\n\n   invoke(hello, args=[\"--help\"])\n```\n","docs/api.md":"# API\n\n```{currentmodule} click\n```\n\nThis part of the documentation lists the full API reference of all public\nclasses and functions.\n\n```{contents}\n:depth: 1\n:local: true\n```\n\n## Decorators\n\n```{eval-rst}\n.. autofunction:: command\n```\n\n```{eval-rst}\n.. autofunction:: group\n```\n\n```{eval-rst}\n.. autofunction:: argument\n```\n\n```{eval-rst}\n.. autofunction:: option\n```\n\n```{eval-rst}\n.. autofunction:: password_option\n```\n\n```{eval-rst}\n.. autofunction:: confirmation_option\n```\n\n```{eval-rst}\n.. autofunction:: version_option\n```\n\n```{eval-rst}\n.. autofunction:: custom_version_option\n```\n\n```{eval-rst}\n.. autofunction:: help_option\n```\n\n```{eval-rst}\n.. autofunction:: pass_context\n```\n\n```{eval-rst}\n.. autofunction:: pass_obj\n```\n\n```{eval-rst}\n.. autofunction:: make_pass_decorator\n```\n\n```{eval-rst}\n.. autofunction:: click.decorators.pass_meta_key\n\n```\n\n## Utilities\n\n```{eval-rst}\n.. autofunction:: echo\n```\n\n```{eval-rst}\n.. autofunction:: echo_via_pager\n```\n\n```{eval-rst}\n.. autofunction:: get_pager_file\n```\n\n```{eval-rst}\n.. autofunction:: prompt\n```\n\n```{eval-rst}\n.. autofunction:: confirm\n```\n\n```{eval-rst}\n.. autofunction:: progressbar\n```\n\n```{eval-rst}\n.. autofunction:: clear\n```\n\n```{eval-rst}\n.. autofunction:: style\n```\n\n```{eval-rst}\n.. autofunction:: unstyle\n```\n\n```{eval-rst}\n.. autofunction:: secho\n```\n\n```{eval-rst}\n.. autofunction:: edit\n```\n\n```{eval-rst}\n.. autofunction:: launch\n```\n\n```{eval-rst}\n.. autofunction:: getchar\n```\n\n```{eval-rst}\n.. autofunction:: pause\n```\n\n```{eval-rst}\n.. autofunction:: get_binary_stream\n```\n\n```{eval-rst}\n.. autofunction:: get_text_stream\n```\n\n```{eval-rst}\n.. autofunction:: open_file\n```\n\n```{eval-rst}\n.. autofunction:: get_app_dir\n```\n\n```{eval-rst}\n.. autofunction:: format_filename\n```\n\n## Commands\n\n```{eval-rst}\n.. autoclass:: BaseCommand\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Command\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: MultiCommand\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Group\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: CommandCollection\n   :members:\n```\n\n## Parameters\n\n```{eval-rst}\n.. autoclass:: Parameter\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Option\n```\n\n```{eval-rst}\n.. autoclass:: Argument\n```\n\n## Context\n\n```{eval-rst}\n.. autoclass:: Context\n   :members:\n```\n\n```{eval-rst}\n.. autofunction:: get_current_context\n```\n\n```{eval-rst}\n.. autoclass:: click.core.ParameterSource\n    :members:\n    :member-order: bysource\n```\n\n(click-api-types)=\n\n## Types\n\n```{eval-rst}\n.. autodata:: STRING\n```\n\n```{eval-rst}\n.. autodata:: INT\n```\n\n```{eval-rst}\n.. autodata:: FLOAT\n```\n\n```{eval-rst}\n.. autodata:: BOOL\n```\n\n```{eval-rst}\n.. autodata:: UUID\n```\n\n```{eval-rst}\n.. autodata:: UNPROCESSED\n```\n\n```{eval-rst}\n.. autoclass:: File\n```\n\n```{eval-rst}\n.. autoclass:: Path\n```\n\n```{eval-rst}\n.. autoclass:: Choice\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: IntRange\n```\n\n```{eval-rst}\n.. autoclass:: FloatRange\n```\n\n```{eval-rst}\n.. autoclass:: DateTime\n```\n\n```{eval-rst}\n.. autoclass:: Tuple\n```\n\n```{eval-rst}\n.. autoclass:: ParamType\n   :members:\n```\n\n## Exceptions\n\n```{eval-rst}\n.. autoexception:: ClickException\n```\n\n```{eval-rst}\n.. autoexception:: Abort\n```\n\n```{eval-rst}\n.. autoexception:: UsageError\n```\n\n```{eval-rst}\n.. autoexception:: BadParameter\n```\n\n```{eval-rst}\n.. autoexception:: FileError\n```\n\n```{eval-rst}\n.. autoexception:: NoSuchCommand\n```\n\n```{eval-rst}\n.. autoexception:: NoSuchOption\n```\n\n```{eval-rst}\n.. autoexception:: BadOptionUsage\n```\n\n```{eval-rst}\n.. autoexception:: BadArgumentUsage\n```\n\n## Formatting\n\n```{eval-rst}\n.. autoclass:: HelpFormatter\n   :members:\n```\n\n```{eval-rst}\n.. autofunction:: wrap_text\n```\n\n## Parsing\n\n```{eval-rst}\n.. autoclass:: OptionParser\n   :members:\n\n```\n\n## Shell Completion\n\nSee {doc}`/shell-completion` for information about enabling and\ncustomizing Click's shell completion system.\n\n```{eval-rst}\n.. currentmodule:: click.shell_completion\n```\n\n```{eval-rst}\n.. autoclass:: CompletionItem\n```\n\n```{eval-rst}\n.. autoclass:: ShellComplete\n    :members:\n    :member-order: bysource\n```\n\n```{eval-rst}\n.. autofunction:: add_completion_class\n\n```\n\n(testing)=\n\n## Testing\n\n```{eval-rst}\n.. currentmodule:: click.testing\n```\n\n```{eval-rst}\n.. autoclass:: CliRunner\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Result\n   :members:\n```\n"},"items":[{"name":"prompts.md","path":"docs/prompts.md","rawUrl":"https://raw.githubusercontent.com/pallets/click/HEAD/docs/prompts.md","title":"docs - Agent Prompts Catalog","category":"root-instruction","format":"markdown","content":"# User Input Prompts\n\n```{currentmodule} click\n```\n\nClick supports prompts in two different places. The first is automated prompts when the parameter handling happens, and\nthe second is to ask for prompts at a later point independently.\n\nThis can be accomplished with the {func}`prompt` function, which asks for valid input according to a type, or the\n{func}`confirm` function, which asks for confirmation (yes/no).\n\n```{contents}\n---\ndepth: 2\nlocal: true\n---\n```\n\n(option-prompting)=\n\n## Option Prompts\n\nOption prompts are integrated into the option interface. Internally, it automatically calls either {func}`prompt` or\n{func}`confirm` as necessary.\n\nIn some cases, you want parameters that can be provided from the command line, but if not provided, ask for user input\ninstead. This can be implemented with Click by defining a prompt string.\n\nExample:\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt=True)\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\nAnd what it looks like:\n\n.. click:run::\n\n    invoke(hello, args=['--name=John'])\n    invoke(hello, input=['John'])\n```\n\nIf you are not happy with the default prompt string, you can ask for\na different one:\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt='Your name please')\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\nWhat it looks like:\n\n.. click:run::\n\n    invoke(hello, input=['John'])\n```\n\nIt is advised that prompt not be used in conjunction with the multiple flag set to True. Instead, prompt in the function\ninteractively.\n\nBy default, the user will be prompted for an input if one was not passed through the command line. To turn this behavior\noff, see {ref}`optional-value`.\n\n## Input Prompts\n\nTo manually ask for user input, you can use the {func}`prompt` function. By default, it accepts any Unicode string, but\nyou can ask for any other type. For instance, you can ask for a valid integer:\n\n```python\nvalue = click.prompt('Please enter a valid integer', type=int)\n```\n\nAdditionally, the type will be determined automatically if a default value is provided. For instance, the following will\nonly accept floats:\n\n```python\nvalue = click.prompt('Please enter a number', default=42.0)\n```\n\n## Optional Prompts\n\nIf the option has `prompt` enabled, then setting `prompt_required=False` tells Click to only show the prompt if the\noption's flag is given, instead of if the option is not provided at all.\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt=True, prompt_required=False, default=\"Default\")\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\n.. click:run::\n\n    invoke(hello)\n    invoke(hello, args=[\"--name\", \"Value\"])\n    invoke(hello, args=[\"--name\"], input=\"Prompt\")\n```\n\nIf `required=True`, then the option will still prompt if it is not given, but it will also prompt if only the flag is\ngiven.\n\n## Confirmation Prompts\n\nTo ask if a user wants to continue with an action, the {func}`confirm` function comes in handy. By default, it returns\nthe result of the prompt as a boolean value:\n\n```python\nif click.confirm('Do you want to continue?'):\n    click.echo('Well done!')\n```\n\nThere is also the option to make the function automatically abort the execution of the program if it does not return\n`True`:\n\n```python\nclick.confirm('Do you want to continue?', abort=True)\n```\n\n## Dynamic Defaults for Prompts\n\nThe `auto_envvar_prefix` and `default_map` options for the context allow the program to read option values from the\nenvironment or a configuration file. However, this overrides the prompting mechanism, so that the user does not get the\noption to change the value interactively.\n\nIf you want to let the user configure the default value, but still be prompted if the option isn't specified on the\ncommand line, you can do so by supplying a callable as the default value. For example, to get a default from the\nenvironment:\n\n```python\nimport os\n\n@click.command()\n@click.option(\n    \"--username\", prompt=True,\n    default=lambda: os.environ.get(\"USER\", \"\")\n)\ndef hello(username):\n    click.echo(f\"Hello, {username}!\")\n```\n\nTo describe what the default value will be, set it in ``show_default``.\n\n```{eval-rst}\n.. click:example::\n\n    import os\n\n    @click.command()\n    @click.option(\n        \"--username\", prompt=True,\n        default=lambda: os.environ.get(\"USER\", \"\"),\n        show_default=\"current user\"\n    )\n    def hello(username):\n        click.echo(f\"Hello, {username}!\")\n\n.. click:run::\n\n   invoke(hello, args=[\"--help\"])\n```\n","isInternal":false,"tokens":1076,"sizeBytes":4575},{"name":"api.md","path":"docs/api.md","rawUrl":"https://raw.githubusercontent.com/pallets/click/HEAD/docs/api.md","title":"docs - API Interface Contract & Specifications","category":"project-spec","format":"markdown","content":"# API\n\n```{currentmodule} click\n```\n\nThis part of the documentation lists the full API reference of all public\nclasses and functions.\n\n```{contents}\n:depth: 1\n:local: true\n```\n\n## Decorators\n\n```{eval-rst}\n.. autofunction:: command\n```\n\n```{eval-rst}\n.. autofunction:: group\n```\n\n```{eval-rst}\n.. autofunction:: argument\n```\n\n```{eval-rst}\n.. autofunction:: option\n```\n\n```{eval-rst}\n.. autofunction:: password_option\n```\n\n```{eval-rst}\n.. autofunction:: confirmation_option\n```\n\n```{eval-rst}\n.. autofunction:: version_option\n```\n\n```{eval-rst}\n.. autofunction:: custom_version_option\n```\n\n```{eval-rst}\n.. autofunction:: help_option\n```\n\n```{eval-rst}\n.. autofunction:: pass_context\n```\n\n```{eval-rst}\n.. autofunction:: pass_obj\n```\n\n```{eval-rst}\n.. autofunction:: make_pass_decorator\n```\n\n```{eval-rst}\n.. autofunction:: click.decorators.pass_meta_key\n\n```\n\n## Utilities\n\n```{eval-rst}\n.. autofunction:: echo\n```\n\n```{eval-rst}\n.. autofunction:: echo_via_pager\n```\n\n```{eval-rst}\n.. autofunction:: get_pager_file\n```\n\n```{eval-rst}\n.. autofunction:: prompt\n```\n\n```{eval-rst}\n.. autofunction:: confirm\n```\n\n```{eval-rst}\n.. autofunction:: progressbar\n```\n\n```{eval-rst}\n.. autofunction:: clear\n```\n\n```{eval-rst}\n.. autofunction:: style\n```\n\n```{eval-rst}\n.. autofunction:: unstyle\n```\n\n```{eval-rst}\n.. autofunction:: secho\n```\n\n```{eval-rst}\n.. autofunction:: edit\n```\n\n```{eval-rst}\n.. autofunction:: launch\n```\n\n```{eval-rst}\n.. autofunction:: getchar\n```\n\n```{eval-rst}\n.. autofunction:: pause\n```\n\n```{eval-rst}\n.. autofunction:: get_binary_stream\n```\n\n```{eval-rst}\n.. autofunction:: get_text_stream\n```\n\n```{eval-rst}\n.. autofunction:: open_file\n```\n\n```{eval-rst}\n.. autofunction:: get_app_dir\n```\n\n```{eval-rst}\n.. autofunction:: format_filename\n```\n\n## Commands\n\n```{eval-rst}\n.. autoclass:: BaseCommand\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Command\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: MultiCommand\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Group\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: CommandCollection\n   :members:\n```\n\n## Parameters\n\n```{eval-rst}\n.. autoclass:: Parameter\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Option\n```\n\n```{eval-rst}\n.. autoclass:: Argument\n```\n\n## Context\n\n```{eval-rst}\n.. autoclass:: Context\n   :members:\n```\n\n```{eval-rst}\n.. autofunction:: get_current_context\n```\n\n```{eval-rst}\n.. autoclass:: click.core.ParameterSource\n    :members:\n    :member-order: bysource\n```\n\n(click-api-types)=\n\n## Types\n\n```{eval-rst}\n.. autodata:: STRING\n```\n\n```{eval-rst}\n.. autodata:: INT\n```\n\n```{eval-rst}\n.. autodata:: FLOAT\n```\n\n```{eval-rst}\n.. autodata:: BOOL\n```\n\n```{eval-rst}\n.. autodata:: UUID\n```\n\n```{eval-rst}\n.. autodata:: UNPROCESSED\n```\n\n```{eval-rst}\n.. autoclass:: File\n```\n\n```{eval-rst}\n.. autoclass:: Path\n```\n\n```{eval-rst}\n.. autoclass:: Choice\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: IntRange\n```\n\n```{eval-rst}\n.. autoclass:: FloatRange\n```\n\n```{eval-rst}\n.. autoclass:: DateTime\n```\n\n```{eval-rst}\n.. autoclass:: Tuple\n```\n\n```{eval-rst}\n.. autoclass:: ParamType\n   :members:\n```\n\n## Exceptions\n\n```{eval-rst}\n.. autoexception:: ClickException\n```\n\n```{eval-rst}\n.. autoexception:: Abort\n```\n\n```{eval-rst}\n.. autoexception:: UsageError\n```\n\n```{eval-rst}\n.. autoexception:: BadParameter\n```\n\n```{eval-rst}\n.. autoexception:: FileError\n```\n\n```{eval-rst}\n.. autoexception:: NoSuchCommand\n```\n\n```{eval-rst}\n.. autoexception:: NoSuchOption\n```\n\n```{eval-rst}\n.. autoexception:: BadOptionUsage\n```\n\n```{eval-rst}\n.. autoexception:: BadArgumentUsage\n```\n\n## Formatting\n\n```{eval-rst}\n.. autoclass:: HelpFormatter\n   :members:\n```\n\n```{eval-rst}\n.. autofunction:: wrap_text\n```\n\n## Parsing\n\n```{eval-rst}\n.. autoclass:: OptionParser\n   :members:\n\n```\n\n## Shell Completion\n\nSee {doc}`/shell-completion` for information about enabling and\ncustomizing Click's shell completion system.\n\n```{eval-rst}\n.. currentmodule:: click.shell_completion\n```\n\n```{eval-rst}\n.. autoclass:: CompletionItem\n```\n\n```{eval-rst}\n.. autoclass:: ShellComplete\n    :members:\n    :member-order: bysource\n```\n\n```{eval-rst}\n.. autofunction:: add_completion_class\n\n```\n\n(testing)=\n\n## Testing\n\n```{eval-rst}\n.. currentmodule:: click.testing\n```\n\n```{eval-rst}\n.. autoclass:: CliRunner\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Result\n   :members:\n```\n","isInternal":false,"tokens":1320,"sizeBytes":4323}],"systemPromptSnippet":"<yakaai_skills repo=\"pallets/click\">\n<!-- File: docs/prompts.md (Tokens: ~1076 | Category: root-instruction) -->\n# User Input Prompts\n\n```{currentmodule} click\n```\n\nClick supports prompts in two different places. The first is automated prompts when the parameter handling happens, and\nthe second is to ask for prompts at a later point independently.\n\nThis can be accomplished with the {func}`prompt` function, which asks for valid input according to a type, or the\n{func}`confirm` function, which asks for confirmation (yes/no).\n\n```{contents}\n---\ndepth: 2\nlocal: true\n---\n```\n\n(option-prompting)=\n\n## Option Prompts\n\nOption prompts are integrated into the option interface. Internally, it automatically calls either {func}`prompt` or\n{func}`confirm` as necessary.\n\nIn some cases, you want parameters that can be provided from the command line, but if not provided, ask for user input\ninstead. This can be implemented with Click by defining a prompt string.\n\nExample:\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt=True)\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\nAnd what it looks like:\n\n.. click:run::\n\n    invoke(hello, args=['--name=John'])\n    invoke(hello, input=['John'])\n```\n\nIf you are not happy with the default prompt string, you can ask for\na different one:\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt='Your name please')\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\nWhat it looks like:\n\n.. click:run::\n\n    invoke(hello, input=['John'])\n```\n\nIt is advised that prompt not be used in conjunction with the multiple flag set to True. Instead, prompt in the function\ninteractively.\n\nBy default, the user will be prompted for an input if one was not passed through the command line. To turn this behavior\noff, see {ref}`optional-value`.\n\n## Input Prompts\n\nTo manually ask for user input, you can use the {func}`prompt` function. By default, it accepts any Unicode string, but\nyou can ask for any other type. For instance, you can ask for a valid integer:\n\n```python\nvalue = click.prompt('Please enter a valid integer', type=int)\n```\n\nAdditionally, the type will be determined automatically if a default value is provided. For instance, the following will\nonly accept floats:\n\n```python\nvalue = click.prompt('Please enter a number', default=42.0)\n```\n\n## Optional Prompts\n\nIf the option has `prompt` enabled, then setting `prompt_required=False` tells Click to only show the prompt if the\noption's flag is given, instead of if the option is not provided at all.\n\n```{eval-rst}\n.. click:example::\n\n    @click.command()\n    @click.option('--name', prompt=True, prompt_required=False, default=\"Default\")\n    def hello(name):\n        click.echo(f\"Hello {name}!\")\n\n.. click:run::\n\n    invoke(hello)\n    invoke(hello, args=[\"--name\", \"Value\"])\n    invoke(hello, args=[\"--name\"], input=\"Prompt\")\n```\n\nIf `required=True`, then the option will still prompt if it is not given, but it will also prompt if only the flag is\ngiven.\n\n## Confirmation Prompts\n\nTo ask if a user wants to continue with an action, the {func}`confirm` function comes in handy. By default, it returns\nthe result of the prompt as a boolean value:\n\n```python\nif click.confirm('Do you want to continue?'):\n    click.echo('Well done!')\n```\n\nThere is also the option to make the function automatically abort the execution of the program if it does not return\n`True`:\n\n```python\nclick.confirm('Do you want to continue?', abort=True)\n```\n\n## Dynamic Defaults for Prompts\n\nThe `auto_envvar_prefix` and `default_map` options for the context allow the program to read option values from the\nenvironment or a configuration file. However, this overrides the prompting mechanism, so that the user does not get the\noption to change the value interactively.\n\nIf you want to let the user configure the default value, but still be prompted if the option isn't specified on the\ncommand line, you can do so by supplying a callable as the default value. For example, to get a default from the\nenvironment:\n\n```python\nimport os\n\n@click.command()\n@click.option(\n    \"--username\", prompt=True,\n    default=lambda: os.environ.get(\"USER\", \"\")\n)\ndef hello(username):\n    click.echo(f\"Hello, {username}!\")\n```\n\nTo describe what the default value will be, set it in ``show_default``.\n\n```{eval-rst}\n.. click:example::\n\n    import os\n\n    @click.command()\n    @click.option(\n        \"--username\", prompt=True,\n        default=lambda: os.environ.get(\"USER\", \"\"),\n        show_default=\"current user\"\n    )\n    def hello(username):\n        click.echo(f\"Hello, {username}!\")\n\n.. click:run::\n\n   invoke(hello, args=[\"--help\"])\n```\n\n<!-- File: docs/api.md (Tokens: ~1320 | Category: project-spec) -->\n# API\n\n```{currentmodule} click\n```\n\nThis part of the documentation lists the full API reference of all public\nclasses and functions.\n\n```{contents}\n:depth: 1\n:local: true\n```\n\n## Decorators\n\n```{eval-rst}\n.. autofunction:: command\n```\n\n```{eval-rst}\n.. autofunction:: group\n```\n\n```{eval-rst}\n.. autofunction:: argument\n```\n\n```{eval-rst}\n.. autofunction:: option\n```\n\n```{eval-rst}\n.. autofunction:: password_option\n```\n\n```{eval-rst}\n.. autofunction:: confirmation_option\n```\n\n```{eval-rst}\n.. autofunction:: version_option\n```\n\n```{eval-rst}\n.. autofunction:: custom_version_option\n```\n\n```{eval-rst}\n.. autofunction:: help_option\n```\n\n```{eval-rst}\n.. autofunction:: pass_context\n```\n\n```{eval-rst}\n.. autofunction:: pass_obj\n```\n\n```{eval-rst}\n.. autofunction:: make_pass_decorator\n```\n\n```{eval-rst}\n.. autofunction:: click.decorators.pass_meta_key\n\n```\n\n## Utilities\n\n```{eval-rst}\n.. autofunction:: echo\n```\n\n```{eval-rst}\n.. autofunction:: echo_via_pager\n```\n\n```{eval-rst}\n.. autofunction:: get_pager_file\n```\n\n```{eval-rst}\n.. autofunction:: prompt\n```\n\n```{eval-rst}\n.. autofunction:: confirm\n```\n\n```{eval-rst}\n.. autofunction:: progressbar\n```\n\n```{eval-rst}\n.. autofunction:: clear\n```\n\n```{eval-rst}\n.. autofunction:: style\n```\n\n```{eval-rst}\n.. autofunction:: unstyle\n```\n\n```{eval-rst}\n.. autofunction:: secho\n```\n\n```{eval-rst}\n.. autofunction:: edit\n```\n\n```{eval-rst}\n.. autofunction:: launch\n```\n\n```{eval-rst}\n.. autofunction:: getchar\n```\n\n```{eval-rst}\n.. autofunction:: pause\n```\n\n```{eval-rst}\n.. autofunction:: get_binary_stream\n```\n\n```{eval-rst}\n.. autofunction:: get_text_stream\n```\n\n```{eval-rst}\n.. autofunction:: open_file\n```\n\n```{eval-rst}\n.. autofunction:: get_app_dir\n```\n\n```{eval-rst}\n.. autofunction:: format_filename\n```\n\n## Commands\n\n```{eval-rst}\n.. autoclass:: BaseCommand\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Command\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: MultiCommand\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Group\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: CommandCollection\n   :members:\n```\n\n## Parameters\n\n```{eval-rst}\n.. autoclass:: Parameter\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Option\n```\n\n```{eval-rst}\n.. autoclass:: Argument\n```\n\n## Context\n\n```{eval-rst}\n.. autoclass:: Context\n   :members:\n```\n\n```{eval-rst}\n.. autofunction:: get_current_context\n```\n\n```{eval-rst}\n.. autoclass:: click.core.ParameterSource\n    :members:\n    :member-order: bysource\n```\n\n(click-api-types)=\n\n## Types\n\n```{eval-rst}\n.. autodata:: STRING\n```\n\n```{eval-rst}\n.. autodata:: INT\n```\n\n```{eval-rst}\n.. autodata:: FLOAT\n```\n\n```{eval-rst}\n.. autodata:: BOOL\n```\n\n```{eval-rst}\n.. autodata:: UUID\n```\n\n```{eval-rst}\n.. autodata:: UNPROCESSED\n```\n\n```{eval-rst}\n.. autoclass:: File\n```\n\n```{eval-rst}\n.. autoclass:: Path\n```\n\n```{eval-rst}\n.. autoclass:: Choice\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: IntRange\n```\n\n```{eval-rst}\n.. autoclass:: FloatRange\n```\n\n```{eval-rst}\n.. autoclass:: DateTime\n```\n\n```{eval-rst}\n.. autoclass:: Tuple\n```\n\n```{eval-rst}\n.. autoclass:: ParamType\n   :members:\n```\n\n## Exceptions\n\n```{eval-rst}\n.. autoexception:: ClickException\n```\n\n```{eval-rst}\n.. autoexception:: Abort\n```\n\n```{eval-rst}\n.. autoexception:: UsageError\n```\n\n```{eval-rst}\n.. autoexception:: BadParameter\n```\n\n```{eval-rst}\n.. autoexception:: FileError\n```\n\n```{eval-rst}\n.. autoexception:: NoSuchCommand\n```\n\n```{eval-rst}\n.. autoexception:: NoSuchOption\n```\n\n```{eval-rst}\n.. autoexception:: BadOptionUsage\n```\n\n```{eval-rst}\n.. autoexception:: BadArgumentUsage\n```\n\n## Formatting\n\n```{eval-rst}\n.. autoclass:: HelpFormatter\n   :members:\n```\n\n```{eval-rst}\n.. autofunction:: wrap_text\n```\n\n## Parsing\n\n```{eval-rst}\n.. autoclass:: OptionParser\n   :members:\n\n```\n\n## Shell Completion\n\nSee {doc}`/shell-completion` for information about enabling and\ncustomizing Click's shell completion system.\n\n```{eval-rst}\n.. currentmodule:: click.shell_completion\n```\n\n```{eval-rst}\n.. autoclass:: CompletionItem\n```\n\n```{eval-rst}\n.. autoclass:: ShellComplete\n    :members:\n    :member-order: bysource\n```\n\n```{eval-rst}\n.. autofunction:: add_completion_class\n\n```\n\n(testing)=\n\n## Testing\n\n```{eval-rst}\n.. currentmodule:: click.testing\n```\n\n```{eval-rst}\n.. autoclass:: CliRunner\n   :members:\n```\n\n```{eval-rst}\n.. autoclass:: Result\n   :members:\n```\n</yakaai_skills>"}