Diff
1diff --git a/dot_config/zsh/completions/flux.zsh b/dot_config/zsh/completions/flux.zsh
2index 10ae9425d4d1931799e460928d35c095d6a25cce..6c53425226ad86d25b6d5bc4bf2ea478a153740b 100644
3--- a/dot_config/zsh/completions/flux.zsh
4+++ b/dot_config/zsh/completions/flux.zsh
5@@ -1,4 +1,4 @@
6-#compdef _flux flux
7+#compdef flux
8
9 # zsh completion for flux -*- shell-script -*-
10
11@@ -86,7 +86,24 @@ _flux()
12 return
13 fi
14
15+ local activeHelpMarker="_activeHelp_ "
16+ local endIndex=${#activeHelpMarker}
17+ local startIndex=$((${#activeHelpMarker}+1))
18+ local hasActiveHelp=0
19 while IFS='\n' read -r comp; do
20+ # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
21+ if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
22+ __flux_debug "ActiveHelp found: $comp"
23+ comp="${comp[$startIndex,-1]}"
24+ if [ -n "$comp" ]; then
25+ compadd -x "${comp}"
26+ __flux_debug "ActiveHelp will need delimiter"
27+ hasActiveHelp=1
28+ fi
29+
30+ continue
31+ fi
32+
33 if [ -n "$comp" ]; then
34 # If requested, completions are returned with a description.
35 # The description is preceded by a TAB character.
36@@ -94,7 +111,7 @@ _flux()
37 # We first need to escape any : as part of the completion itself.
38 comp=${comp//:/\\:}
39
40- local tab=$(printf '\t')
41+ local tab="$(printf '\t')"
42 comp=${comp//$tab/:}
43
44 __flux_debug "Adding completion: ${comp}"
45@@ -103,6 +120,17 @@ _flux()
46 fi
47 done < <(printf "%s\n" "${out[@]}")
48
49+ # Add a delimiter after the activeHelp statements, but only if:
50+ # - there are completions following the activeHelp statements, or
51+ # - file completion will be performed (so there will be choices after the activeHelp)
52+ if [ $hasActiveHelp -eq 1 ]; then
53+ if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
54+ __flux_debug "Adding activeHelp delimiter"
55+ compadd -x "--"
56+ hasActiveHelp=0
57+ fi
58+ fi
59+
60 if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
61 __flux_debug "Activating nospace."
62 noSpace="-S ''"
63diff --git a/dot_config/zsh/completions/gt.zsh b/dot_config/zsh/completions/gt.zsh
64new file mode 100644
65index 0000000000000000000000000000000000000000..6cc0a71a6a2a7df25184a505f57dc953fec4b87d
66--- /dev/null
67+++ b/dot_config/zsh/completions/gt.zsh
68@@ -0,0 +1,19 @@
69+#compdef gt
70+###-begin-gt-completions-###
71+#
72+# yargs command completion script
73+#
74+# Installation: gt completion >> ~/.zshrc
75+# or gt completion >> ~/.zprofile on OSX.
76+#
77+_gt_yargs_completions()
78+{
79+ local reply
80+ local si=$IFS
81+ IFS=$'
82+' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" gt --get-yargs-completions "${words[@]}"))
83+ IFS=$si
84+ _describe 'values' reply
85+}
86+compdef _gt_yargs_completions gt
87+###-end-gt-completions-###