Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
225425fe
Unverified
Commit
225425fe
authored
Oct 24, 2019
by
Marc Cornellà
Committed by
GitHub
Oct 24, 2019
Browse files
Fix target_list creation. Supports fabric 1 and 2
parent
9dd76fb6
Changes
1
Show whitespace changes
Inline
Side-by-side
plugins/fabric/_fab
View file @
225425fe
...
@@ -4,13 +4,19 @@
...
@@ -4,13 +4,19 @@
local curcontext=$curcontext state line
local curcontext=$curcontext state line
declare -A opt_args
declare -A opt_args
declare target_list
declare -a target_list
IFS="$(printf '\n+')" target_list=($(fab -l | awk '{
target_list=("${(@f)$(fab -l 2>/dev/null | awk '{
if(NR > 2)
if (NF == 0 || NR == 1) return
printf "%s:%s\n", $1, substr($0, index($0, $2))
if (NF < 2) print $1
}' 2>/dev/null))
else {
docstring=substr($0, index($0,$2))
gsub(":", "\\:", docstring)
print $1":"docstring
}
}')}")
_targets() {
_fab_targets() {
[[ -n "$target_list" ]] || return
_describe -t commands "fabric targets" target_list
_describe -t commands "fabric targets" target_list
}
}
...
@@ -31,7 +37,7 @@ _arguments -w -S -C \
...
@@ -31,7 +37,7 @@ _arguments -w -S -C \
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
"(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
"(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_
fab_
targets" \
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
...
@@ -56,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
...
@@ -56,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
levels)
levels)
_describe -t commands "output levels" output_levels;;
_describe -t commands "output levels" output_levels;;
*)
*)
_targets;;
_fab
_targets;;
esac
esac
return
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment