Please complete the following tasks
Rust Version
rustc 1.98.0-nightly (beae78130 2026-06-09)
Clap Version
4.6.1
Minimal reproducible code
fn main() {
clap_complete::CompleteEnv::with_factory(Args::command).complete();
}
#[derive(clap::Parser)]
#[command]
struct Args;
Steps to reproduce the bug with the above code
- Install pwsh e.g.,
brew install powershell on macOS or linux.
- Run:
pwsh
cargo add clap clap-complete -F clap/derivbe,clap-complete/unstable-dynamic
- Run:
COMPLETE=$(which pwsh) cargo run. This is documented as supported in source. The main idea anyway is to show that, on any platform including Windows (powershell.exe is supported but basically EOL; pwsh is the way forward and has been for many years), pwsh is the executable you should be checking.
Actual Behaviour
error: unknown shell pwsh, expected one of bash, elvish, fish, powershell, zsh
Expected Behaviour
Works like it would if the executable were powershell or for any other shell like bash.
Additional Context
Based on PowerShell/PowerShell#12150 and my own testing, SHELL is unreliable. Seems only the initial shell sets it. Once set, it's never overwritten, which is partly why PowerShell closed it. Even if I start bash (default shell) then zsh on macOS, SHELL is still "bash".
Some other programs detect the parent process tree up to ~10 processes or so using sysinfo or similar.
Debug Output
No response
Please complete the following tasks
Rust Version
rustc 1.98.0-nightly (beae78130 2026-06-09)
Clap Version
4.6.1
Minimal reproducible code
Steps to reproduce the bug with the above code
brew install powershellon macOS or linux.pwshcargo add clap clap-complete -F clap/derivbe,clap-complete/unstable-dynamicCOMPLETE=$(which pwsh) cargo run. This is documented as supported in source. The main idea anyway is to show that, on any platform including Windows (powershell.exe is supported but basically EOL; pwsh is the way forward and has been for many years),pwshis the executable you should be checking.Actual Behaviour
Expected Behaviour
Works like it would if the executable were
powershellor for any other shell likebash.Additional Context
Based on PowerShell/PowerShell#12150 and my own testing,
SHELLis unreliable. Seems only the initial shell sets it. Once set, it's never overwritten, which is partly why PowerShell closed it. Even if I start bash (default shell) then zsh on macOS,SHELLis still "bash".Some other programs detect the parent process tree up to ~10 processes or so using
sysinfoor similar.Debug Output
No response