From 37e176d83cab1bc4a2a6707303c85f06f431aed7 Mon Sep 17 00:00:00 2001 From: Rolando Bosch Date: Sun, 6 Sep 2026 02:25:03 -0400 Subject: [PATCH 1/2] docs: explain how to enable shell completion --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index a08d6141..22dca395 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,41 @@ $ dotenv run -- python foo.py Run `dotenv --help` for more information about the options and subcommands. +### Shell completion + +The `dotenv` command supports tab completion for Bash, Zsh, Fish, and +PowerShell. Add the command for your shell to its startup file: + +**Bash** (`~/.bashrc`): + +```bash +eval "$(_DOTENV_COMPLETE=bash_source dotenv)" +``` + +**Zsh** (`~/.zshrc`): + +```zsh +eval "$(_DOTENV_COMPLETE=zsh_source dotenv)" +``` + +**Fish** (`~/.config/fish/config.fish`): + +```fish +_DOTENV_COMPLETE=fish_source dotenv | source +``` + +**PowerShell** (the path in `$PROFILE`): + +```powershell +$env:_DOTENV_COMPLETE = 'powershell_source' +dotenv | Out-String | Invoke-Expression +Remove-Item Env:_DOTENV_COMPLETE +``` + +Restart the shell after updating its startup file. See Click's +[shell completion documentation](https://click.palletsprojects.com/en/stable/shell-completion/) +for startup file locations and an alternative that caches the generated script. + ## File format The format is not formally specified and still improves over time. That being From a398a6373f4b99614b8b4867ee0361bdf0f26d6c Mon Sep 17 00:00:00 2001 From: Rolando Bosch Date: Sun, 6 Sep 2026 02:39:42 -0400 Subject: [PATCH 2/2] docs: qualify shell completion versions --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 22dca395..f22763c7 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,9 @@ Run `dotenv --help` for more information about the options and subcommands. The `dotenv` command supports tab completion for Bash, Zsh, Fish, and PowerShell. Add the command for your shell to its startup file: +Bash, Zsh, and Fish completion require Click 8.0 or newer. PowerShell +completion requires Click 8.5 or newer, and Bash requires version 4.4 or newer. + **Bash** (`~/.bashrc`): ```bash