Skip to content

Conversation

@jgreitemann
Copy link
Contributor

The previous instructions were wrong in that they set the COMPLETE env var only while the $PROFILE script was written. This was akin to

COMPLETE=bash echo "source <(your_program)" >> ~/.bashrc

whereas the corrected version sets COMPLETE as part of the $PROFILE script, mirroring the instructions for sourcing completion in the other shells.

Extending $PROFILE in this way also requires that scripts are allowed to be executed. This requires changing the execution policy from its default value Restricted on Windows. There's no such issue when using PowerShell on macOS or Linux.

@jgreitemann jgreitemann changed the title docs(clap_complete): fix instructions to source PowerShell completions docs(complete): Fix instructions for sourcing PowerShell completions Nov 9, 2025
The previous instructions were wrong in that they set the `COMPLETE`
env var only while the `$PROFILE` script was written. This was akin to

    COMPLETE=bash echo "source <(your_program)" >> ~/.bashrc

whereas the corrected version sets `COMPLETE` as part of the `$PROFILE`
script, mirroring the instructions for sourcing completion in the other
shells.

Extending `$PROFILE` in this way also requires that scripts are allowed
to be executed. This requires changing the execution policy from its
default value `Restricted` on Windows. There's no such issue when using
PowerShell on macOS or Linux.
@epage
Copy link
Member

epage commented Nov 10, 2025

Thanks!

@epage epage merged commit bb0b2f1 into clap-rs:master Nov 10, 2025
25 checks passed
@jgreitemann jgreitemann deleted the jg/kqvvzuzuzywv branch November 10, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants