mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
style(completions/ssh): clean up
* style(completions/ssh): normalize quoting
This commit is contained in:
@ -7,10 +7,11 @@ function _omb_completion_ssh {
|
|||||||
local cur
|
local cur
|
||||||
_omb_completion_reassemble_breaks :
|
_omb_completion_reassemble_breaks :
|
||||||
|
|
||||||
|
local -a options
|
||||||
if [[ $cur == *@* ]] ; then
|
if [[ $cur == *@* ]] ; then
|
||||||
local -a options=(-P "${cur%%@*}@" -- "${cur#*@}")
|
options=(-P "${cur%%@*}@" -- "${cur#*@}")
|
||||||
else
|
else
|
||||||
local -a options=(-- "$cur")
|
options=(-- "$cur")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
@ -34,7 +35,7 @@ function _omb_completion_ssh {
|
|||||||
local include_file
|
local include_file
|
||||||
for include_file in "${include_files[@]}";do
|
for include_file in "${include_files[@]}";do
|
||||||
# parse all defined hosts from that file
|
# parse all defined hosts from that file
|
||||||
[[ -s "$include_file" ]] && config_files+=("$include_file")
|
[[ -s $include_file ]] && config_files+=("$include_file")
|
||||||
done
|
done
|
||||||
|
|
||||||
COMPREPLY+=($(compgen -W "$(awk '/^Host/ {for (i=2; i<=NF; i++) print $i}' "${config_files[@]}")" "${options[@]}"))
|
COMPREPLY+=($(compgen -W "$(awk '/^Host/ {for (i=2; i<=NF; i++) print $i}' "${config_files[@]}")" "${options[@]}"))
|
||||||
|
Reference in New Issue
Block a user