-
Notifications
You must be signed in to change notification settings - Fork 391
fix(_comp_compgen_*): avoid conflicts with "-v var" #1028
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
+182
−105
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
743d0a9
fix(_known_hosts): use array for `options` (work around SC2178,SC2179)
akinomyoga 201239c
fix(_get_cword_at_cursor,cvs): quote array length
akinomyoga b603535
feat(_comp_compgen): support `-U var` to unlocal var
akinomyoga 7d2867c
fix(bts): update functions to generators and fix variable conflicts
akinomyoga 0d145c9
fix(cvs): avoid variable conflicts
akinomyoga a31906c
fix(openssl): avoid variable conflicts
akinomyoga bef94c3
fix(python): avoid variable conflicts
akinomyoga f2df91d
fix(ssh): avoid variable conflicts
akinomyoga 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
Large diffs are not rendered by default.
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
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ _comp_cmd_ssh__compgen_queries() | |
key-plain key-sig protocol-version compression sig ciphers macs | ||
kexalgorithms pubkeyacceptedkeytypes hostkeyalgorithms | ||
hostbasedkeytypes hostbasedacceptedkeytypes) | ||
_comp_compgen -c "${cur,,}" -- -W '"${ret[@]}" help"' | ||
_comp_compgen -c "${cur,,}" -U ret -- -W '"${ret[@]}" help"' | ||
} | ||
|
||
# @since 2.12 | ||
|
@@ -37,7 +37,7 @@ _comp_cmd_ssh__compgen_ciphers() | |
[[ ${ret-} ]] || ret=(3des-cbc aes128-cbc aes192-cbc aes256-cbc | ||
aes128-ctr aes192-ctr aes256-ctr arcfour128 arcfour256 arcfour | ||
blowfish-cbc cast128-cbc) | ||
_comp_compgen -- -W '"${ret[@]}"' | ||
_comp_compgen -U ret -- -W '"${ret[@]}"' | ||
} | ||
|
||
_comp_cmd_ssh__compgen_macs() | ||
|
@@ -46,7 +46,7 @@ _comp_cmd_ssh__compgen_macs() | |
_comp_compgen -v ret -i ssh query "$1" mac | ||
[[ ${ret-} ]] || ret=(hmac-md5 hmac-sha1 [email protected] | ||
hmac-ripemd160 hmac-sha1-96 hmac-md5-96) | ||
_comp_compgen -- -W '"${ret[@]}"' | ||
_comp_compgen -U ret -- -W '"${ret[@]}"' | ||
} | ||
|
||
# @since 2.12 | ||
|
@@ -283,7 +283,7 @@ _comp_xfunc_ssh_compgen_identityfile() | |
local cur=$cur tmp | ||
[[ ! $cur && -d ~/.ssh ]] && cur=~/.ssh/id | ||
_comp_compgen -v tmp -c "$cur" filedir && | ||
_comp_compgen -- -W '"${tmp[@]}"' -X "${1:+!}*.pub" | ||
_comp_compgen -U tmp -- -W '"${tmp[@]}"' -X "${1:+!}*.pub" | ||
} | ||
|
||
_comp_deprecate_func 2.12 _ssh_identityfile _comp_xfunc_ssh_compgen_identityfile | ||
|
@@ -467,35 +467,35 @@ _comp_xfunc_scp_compgen_remote_files() | |
# remove backslash escape from the first colon | ||
cur=${cur/\\:/:} | ||
|
||
local userhost=${cur%%?(\\):*} | ||
local path=${cur#*:} | ||
local _userhost=${cur%%?(\\):*} | ||
local _path=${cur#*:} | ||
|
||
# unescape (3 backslashes to 1 for chars we escaped) | ||
# shellcheck disable=SC2090 | ||
path=$(command sed -e 's/\\\\\\\('"$_comp_cmd_scp__path_esc"'\)/\\\1/g' <<<"$path") | ||
_path=$(command sed -e 's/\\\\\\\('"$_comp_cmd_scp__path_esc"'\)/\\\1/g' <<<"$_path") | ||
|
||
# default to home dir of specified user on remote host | ||
if [[ ! $path ]]; then | ||
path=$(ssh -o 'Batchmode yes' "$userhost" pwd 2>/dev/null) | ||
if [[ ! $_path ]]; then | ||
_path=$(ssh -o 'Batchmode yes' "$_userhost" pwd 2>/dev/null) | ||
fi | ||
|
||
local files | ||
local _files | ||
if [[ ${1-} == -d ]]; then | ||
# escape problematic characters; remove non-dirs | ||
# shellcheck disable=SC2090 | ||
files=$(ssh -o 'Batchmode yes' "$userhost" \ | ||
command ls -aF1dL "$path*" 2>/dev/null | | ||
_files=$(ssh -o 'Batchmode yes' "$_userhost" \ | ||
command ls -aF1dL "$_path*" 2>/dev/null | | ||
command sed -e 's/'"$_comp_cmd_scp__path_esc"'/\\\\\\&/g' -e '/[^\/]$/d') | ||
else | ||
# escape problematic characters; remove executables, aliases, pipes | ||
# and sockets; add space at end of file names | ||
# shellcheck disable=SC2090 | ||
files=$(ssh -o 'Batchmode yes' "$userhost" \ | ||
command ls -aF1dL "$path*" 2>/dev/null | | ||
_files=$(ssh -o 'Batchmode yes' "$_userhost" \ | ||
command ls -aF1dL "$_path*" 2>/dev/null | | ||
command sed -e 's/'"$_comp_cmd_scp__path_esc"'/\\\\\\&/g' -e 's/[*@|=]$//g' \ | ||
-e 's/[^\/]$/& /g') | ||
fi | ||
_comp_split -l COMPREPLY "$files" | ||
_comp_compgen_split -l -- "$_files" | ||
} | ||
|
||
# @deprecated 2.12 use `_comp_compgen -ax ssh remote_files` instead | ||
|
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
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.