-
Notifications
You must be signed in to change notification settings - Fork 391
feat: add 3rd party generated completion fallbacks #905
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d1a2999
feat(__load_completion): localize default `$IFS`
scop 77f2c6b
refactor: refer to underscore prefixed files as "fallback"
scop f402bf0
feat(gh): add fallback 3rd party completion loader
scop 363b9fc
feat(golangci-lint): add fallback 3rd party completion loader
scop 031e317
feat(hugo): add fallback 3rd party completion loader
scop f4e3109
feat(upctl): add fallback 3rd party completion loader
scop ef651f8
feat(sshi): add fallback 3rd party completion loader
scop 3a1103e
feat(vacuum): add fallback 3rd party completion loader
scop 3c1947b
feat(yq): add fallback 3rd party completion loader
scop d27b144
feat(ruff): add fallback 3rd party completion loader
scop 8610d7d
feat(rustup): add fallback 3rd party completion loader
scop 7cd9cb9
feat(cargo): add fallback 3rd party completion loader
scop 5618654
feat(__load_completion): pass backslashless command to fallback loads
scop 328ecf7
feat(kn): add fallback 3rd party completion loader
scop 43da208
refactor: use `eval` instead of tweaking POSIX mode in 3rd party loaders
scop 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
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,13 @@ | ||
# 3rd party completion loader for cargo -*- shell-script -*- | ||
# | ||
# This serves as a fallback in case the completion is not installed otherwise. | ||
|
||
# shellcheck disable=SC2168 # "local" is ok, assume sourced by __load_completion | ||
local rustup="${1%cargo}rustup" # use rustup from same dir | ||
eval -- "$("$rustup" completions bash cargo 2>/dev/null)" | ||
|
||
{ | ||
complete -p "$1" || complete -p "${1##*/}" | ||
} &>/dev/null | ||
|
||
# ex: filetype=sh |
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,12 @@ | ||
# 3rd party completion loader for commands emitting -*- shell-script -*- | ||
# their completion using "$cmd completion --shell bash". | ||
# | ||
# This serves as a fallback in case the completion is not installed otherwise. | ||
|
||
eval -- "$("$1" completion --shell bash 2>/dev/null)" | ||
|
||
{ | ||
complete -p "$1" || complete -p "${1##*/}" | ||
} &>/dev/null | ||
|
||
# ex: filetype=sh |
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,13 @@ | ||
# 3rd party completion loader for commands emitting -*- shell-script -*- | ||
# their completion using "$cmd completion bash". | ||
# For example, many Go programs using https://github.com/spf13/cobra do. | ||
# | ||
# This serves as a fallback in case the completion is not installed otherwise. | ||
|
||
eval -- "$("$1" completion bash 2>/dev/null)" | ||
|
||
{ | ||
complete -p "$1" || complete -p "${1##*/}" | ||
} &>/dev/null | ||
|
||
# ex: filetype=sh |
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,12 @@ | ||
# 3rd party completion loader for commands emitting -*- shell-script -*- | ||
# their completion using "$cmd generate-shell-completion bash". | ||
# | ||
# This serves as a fallback in case the completion is not installed otherwise. | ||
|
||
eval -- "$("$1" generate-shell-completion bash 2>/dev/null)" | ||
|
||
{ | ||
complete -p "$1" || complete -p "${1##*/}" | ||
} &>/dev/null | ||
|
||
# ex: filetype=sh |
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,11 @@ | ||
# 3rd party completion loader for rustup -*- shell-script -*- | ||
# | ||
# This serves as a fallback in case the completion is not installed otherwise. | ||
|
||
eval -- "$("$1" completions bash rustup 2>/dev/null)" | ||
|
||
{ | ||
complete -p "$1" || complete -p "${1##*/}" | ||
} &>/dev/null | ||
|
||
# ex: filetype=sh |
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,12 @@ | ||
# 3rd party completion loader for commands emitting -*- shell-script -*- | ||
# their completion using "$cmd shell-completion bash". | ||
# | ||
# This serves as a fallback in case the completion is not installed otherwise. | ||
|
||
eval -- "$("$1" shell-completion bash 2>/dev/null)" | ||
|
||
{ | ||
complete -p "$1" || complete -p "${1##*/}" | ||
} &>/dev/null | ||
|
||
# ex: filetype=sh |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
SUBDIRS = deprecated t | ||
SUBDIRS = fallback t | ||
|
||
EXTRA_DIST = config \ | ||
fixtures \ | ||
|
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 was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SUBDIRS = completions | ||
|
||
EXTRA_DIST = \ | ||
update-fallback-links | ||
|
||
update: | ||
./update-fallback-links |
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,8 @@ | ||
# test/fallback/completions | ||
|
||
This directory should contain a non-underscore prefixed symlink to | ||
corresponding underscore prefixed, fallback completions we have in the tree. | ||
|
||
The test suite sets up loading of completions so that this dir is preferred | ||
over system install locations, in order to test our fallback in-tree | ||
completions over possibly installed non-fallback out-of-tree ones. |
File renamed without changes.
File renamed without changes.
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 @@ | ||
../../../completions/_cargo |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ | ||
../../../completions/_gh |
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 @@ | ||
../../../completions/_golangci-lint |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ | ||
../../../completions/_ruff |
File renamed without changes.
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 @@ | ||
../../../completions/_rustup |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ | ||
../../../completions/_yq |
File renamed without changes.
File renamed without changes.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is something we could consider adding a test for, but I'm not sure if it's worth the trouble.
Also not sure about adding tests for the the actual completions as their result varies depending on if the generating command is installed or not.