-
-
Notifications
You must be signed in to change notification settings - Fork 190
Adds shell completions for lychee #1972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mre
wants to merge
9
commits into
master
Choose a base branch
from
add-shell-completions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
556593b
Adds shell completions for lychee
mre c0a608f
add temporary test completions workflow
mre b1a1ba5
Configure doc-valid-idents for rustdoc and clippy
mre e64b09c
cleanup
mre 5f7bb2a
cleanup
mre c765094
fix doc test
mre d120d40
Add `make completions`
mre 78eb112
Avoid rebuilding binary for testing shell completions
mre 4a88fa9
Clean up autogenerated shell-completions
mre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| doc-valid-idents = ["PowerShell", ".."] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # Shell Completions for lychee | ||
|
|
||
| lychee comes with built-in support for generating shell completions. | ||
| This unlocks tab-completion for commands, options, and arguments in your shell! | ||
|
|
||
| ## Installation | ||
|
|
||
| ### Bash | ||
|
|
||
| **User installation:** | ||
| ```bash | ||
| dir="${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" | ||
| mkdir -p "$dir" | ||
| lychee --generate complete-bash > "$dir/lychee.bash" | ||
| ``` | ||
|
|
||
| Then source it in your `~/.bashrc` or `~/.bash_profile`: | ||
| ```bash | ||
| source "$dir/lychee.bash" | ||
| ``` | ||
|
|
||
| **System-wide installation:** | ||
| ```bash | ||
| # On Linux | ||
| sudo lychee --generate complete-bash > /usr/share/bash-completion/completions/lychee | ||
|
|
||
| # On macOS with Homebrew | ||
| lychee --generate complete-bash > $(brew --prefix)/etc/bash_completion.d/lychee | ||
| ``` | ||
|
|
||
| ### Zsh | ||
|
|
||
| **Recommended approach:** | ||
|
|
||
| ```zsh | ||
| dir="$HOME/.zsh-completions" | ||
| mkdir -p "$dir" | ||
| lychee --generate complete-zsh > "$dir/_lychee" | ||
| ``` | ||
|
|
||
| Add to your `~/.zshrc`: | ||
| ```zsh | ||
| fpath=($HOME/.zsh-completions $fpath) | ||
| autoload -Uz compinit && compinit | ||
| ``` | ||
|
|
||
| **System-wide installation:** | ||
| ```bash | ||
| # On Linux | ||
| sudo lychee --generate complete-zsh > /usr/local/share/zsh/site-functions/_lychee | ||
|
|
||
| # On macOS with Homebrew | ||
| lychee --generate complete-zsh > $(brew --prefix)/share/zsh/site-functions/_lychee | ||
| ``` | ||
|
|
||
| **Alternative (slower, not recommended for daily use):** | ||
|
|
||
| You can generate completions on-the-fly by adding this to `~/.zshrc`: | ||
| ```zsh | ||
| source <(lychee --generate complete-zsh) | ||
| ``` | ||
|
|
||
| Note: This is easier to set up but slower, adding startup time to your shell. | ||
|
|
||
| ### Fish | ||
|
|
||
| **User installation:** | ||
| ```bash | ||
| dir="${XDG_CONFIG_HOME:-$HOME/.config}/fish/completions" | ||
| mkdir -p "$dir" | ||
| lychee --generate complete-fish > "$dir/lychee.fish" | ||
| ``` | ||
|
|
||
| Fish will automatically load the completions on next shell start. | ||
|
|
||
| **System-wide installation:** | ||
| ```bash | ||
| # On Linux | ||
| sudo lychee --generate complete-fish > /usr/share/fish/vendor_completions.d/lychee.fish | ||
|
|
||
| # On macOS with Homebrew | ||
| lychee --generate complete-fish > $(brew --prefix)/share/fish/vendor_completions.d/lychee.fish | ||
| ``` | ||
|
|
||
| ### Elvish | ||
|
|
||
| ```bash | ||
| dir="${XDG_CONFIG_HOME:-$HOME/.config}/elvish/lib" | ||
| mkdir -p "$dir" | ||
| lychee --generate complete-elvish > "$dir/lychee.elv" | ||
| ``` | ||
|
|
||
| Then add the following to your `~/.elvish/rc.elv`: | ||
| ```elvish | ||
| use lychee | ||
| ``` | ||
|
|
||
| **PowerShell:** Verify your execution policy allows running scripts: | ||
| ```powershell | ||
| Get-ExecutionPolicy | ||
| # If restricted, run: | ||
| Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | ||
| ``` | ||
|
|
||
| ### Updating completions | ||
|
|
||
| After upgrading lychee, regenerate completions to get the latest options: | ||
| ```bash | ||
| lychee --generate complete-<your-shell> > <completion-file> | ||
| ``` | ||
|
|
||
| ### PowerShell | ||
|
|
||
| **Windows:** | ||
|
|
||
| Generate the completion file: | ||
| ```powershell | ||
| lychee --generate complete-powershell | Out-File -Encoding UTF8 _lychee.ps1 | ||
| ``` | ||
|
|
||
| Then add to your PowerShell profile: | ||
| ```powershell | ||
| # Find your profile location | ||
| echo $PROFILE | ||
|
|
||
| # Add this line to your profile | ||
| . C:\Path\To\_lychee.ps1 | ||
| ``` | ||
|
|
||
| **Linux/macOS with PowerShell:** | ||
| ```bash | ||
| lychee --generate complete-powershell > ~/.config/powershell/_lychee.ps1 | ||
| ``` | ||
|
|
||
| Add to your profile (`~/.config/powershell/Microsoft.PowerShell_profile.ps1`): | ||
| ```powershell | ||
| . ~/.config/powershell/_lychee.ps1 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.