{"id":7946,"library":"auto-click-auto","title":"auto-click-auto","description":"auto-click-auto is a small Python library (current version 0.1.5) that automatically enables tab shell completion for Bash (version 4.4 and up), Zsh, and Fish in Click CLI applications. It aims to simplify the setup of shell completion compared to Click's native methods by offering a seamless, automatic configuration. The project has a low-to-moderate release cadence, with the latest update on June 26, 2024.","status":"active","version":"0.1.5","language":"en","source_language":"en","source_url":"https://github.com/KAUTH/auto-click-auto","tags":["CLI","Click","autocompletion","shell","developer tool"],"install":[{"cmd":"pip install auto-click-auto","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core dependency for building CLI applications that auto-click-auto extends for shell completion.","package":"Click","optional":false}],"imports":[{"note":"Used for general, automatic enabling of shell completion within your Click application.","symbol":"enable_click_shell_completion","correct":"from auto_click_auto import enable_click_shell_completion"},{"note":"Intended to be used as a decorator on a Click command for enabling shell completion.","symbol":"enable_click_shell_completion_option","correct":"from auto_click_auto import enable_click_shell_completion_option"},{"note":"Enum representing supported shell types (Bash, Zsh, Fish) for configuration.","symbol":"ShellType","correct":"from auto_click_auto.constants import ShellType"}],"quickstart":{"code":"import click\nfrom auto_click_auto import enable_click_shell_completion\nfrom auto_click_auto.constants import ShellType\nimport os # Only for example program_name, not strictly for auto-click-auto\n\n@click.command()\n@click.option('--count', default=1, help='Number of greetings.')\n@click.option('--name', prompt='Your name', help='The person to greet.')\ndef hello(count, name):\n    \"\"\"Simple program that greets NAME for a total of COUNT times.\"\"\"\n    for x in range(count):\n        click.echo(f\"Hello {name}!\")\n    \n    # Automatically enable shell completion for specified shells\n    # Replace 'my-cli-app' with the actual executable name of your CLI\n    # For testing, you might use 'python -m my_cli_module' as the program_name\n    enable_click_shell_completion(\n        program_name=os.path.basename(__file__).replace('.py', ''), # Derives name from script, adjust for packaged CLIs\n        shells={ShellType.BASH, ShellType.ZSH, ShellType.FISH},\n        # For debugging, add debug=True\n    )\n\nif __name__ == '__main__':\n    hello()","lang":"python","description":"This quickstart demonstrates integrating `auto-click-auto` into a basic Click CLI. The `enable_click_shell_completion` function is called at the end of the main CLI function, providing the program's executable name and a set of `ShellType` enums for which to enable completion."},"warnings":[{"fix":"Review Click's official documentation on shell completion to understand the native options before deciding on `auto-click-auto`. If your needs are simple and manual setup is acceptable, native Click completion might be preferred.","message":"Click versions 8.0.0 and above include native shell completion features. While `auto-click-auto` simplifies the automatic setup, users should be aware of Click's built-in capabilities, which might be sufficient for some use cases.","severity":"gotcha","affected_versions":"Click >= 8.0.0"},{"fix":"Monitor the project's GitHub repository for updates regarding its status and any recommendations for migration to Click's native completion or alternative tools if it becomes archived. Consider this when choosing long-term dependencies.","message":"The project author has noted that `auto-click-auto` might be duplicating functionality now integrated into Click itself and \"might need to be archived.\" This suggests potential long-term maintenance uncertainty or eventual deprecation if Click's native features fully encompass its purpose.","severity":"deprecated","affected_versions":"All versions"},{"fix":"Verify that your target shell is one of the supported types and meets the minimum version requirements. For unsupported shells, you would need to implement custom completion logic or use another library like `click-completion` (though it's in maintenance mode for Click < 8.0).","message":"`auto-click-auto` explicitly supports Bash (version 4.4 and up), Zsh, and Fish. Autocompletion will not work out-of-the-box for other shell environments (e.g., PowerShell, older Bash versions).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure `program_name` exactly matches how your CLI is invoked (e.g., if you run `my-app`, `program_name='my-app'`). After the first run of the CLI with `auto-click-auto` enabled, ensure you reload your shell (e.g., `source ~/.bashrc` or open a new terminal) or follow any specific instructions `auto-click-auto` prints to stdout. Double-check your shell version and type compatibility.","cause":"This can happen if the `program_name` passed to `enable_click_shell_completion` does not match the actual executable name used to run your CLI, or if the shell's configuration (`~/.bashrc`, `~/.zshrc`, etc.) hasn't been reloaded or the necessary `eval` command hasn't been run after the initial setup. It might also be due to an unsupported shell version or type.","error":"Shell autocompletion is not working after installing and configuring 'auto-click-auto'."},{"fix":"If you require PowerShell completion, `auto-click-auto` is not the right tool. You would need to explore Click's native methods for adding custom shell support (which is a more technical process) or look for other third-party Click extensions specifically designed for PowerShell completion, if available.","cause":"`auto-click-auto` only supports Bash (4.4+), Zsh, and Fish. It does not provide built-in support for PowerShell or other shells.","error":"Error: 'ShellType.POWERSHELL' is not a valid ShellType, or autocompletion does not work in PowerShell."}]}