Skip to content

Commit

Permalink
style(completions/ssh): clean up
Browse files Browse the repository at this point in the history
* style(completions/ssh): normalize quoting
  • Loading branch information
akinomyoga committed May 9, 2024
1 parent ad14b87 commit c2ca9be
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions completions/ssh.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ function _omb_completion_ssh {
local cur
_omb_completion_reassemble_breaks :

local -a options
if [[ $cur == *@* ]] ; then
local -a options=(-P "${cur%%@*}@" -- "${cur#*@}")
options=(-P "${cur%%@*}@" -- "${cur#*@}")
else
local -a options=(-- "$cur")
options=(-- "$cur")
fi

local IFS=$'\n'
Expand All @@ -34,7 +35,7 @@ function _omb_completion_ssh {
local include_file
for include_file in "${include_files[@]}";do
# parse all defined hosts from that file
[[ -s "$include_file" ]] && config_files+=("$include_file")
[[ -s $include_file ]] && config_files+=("$include_file")
done

COMPREPLY+=($(compgen -W "$(awk '/^Host/ {for (i=2; i<=NF; i++) print $i}' "${config_files[@]}")" "${options[@]}"))
Expand Down

0 comments on commit c2ca9be

Please sign in to comment.