about summary refs log tree commit homepage
path: root/contrib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-18 18:27:09 +0600
committerEric Wong <e@80x24.org>2021-02-18 20:02:07 -0400
commita2415fec470dad7d9848b55af7c156f96dde13e5 (patch)
tree5da07fd6f54b593131519829aaee389f0a959727 /contrib
parentba95bad037aca78d32ec4ee1ab3a2994ff3953f5 (diff)
downloadpublic-inbox-a2415fec470dad7d9848b55af7c156f96dde13e5.tar.gz
We'll be completing more options with ':', '//' and '=' in the
future, so make it easier to disable trailing spaces on
completions.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/lei-completion.bash10
1 files changed, 4 insertions, 6 deletions
diff --git a/contrib/completion/lei-completion.bash b/contrib/completion/lei-completion.bash
index 619805fb..2c28d44a 100644
--- a/contrib/completion/lei-completion.bash
+++ b/contrib/completion/lei-completion.bash
@@ -4,14 +4,12 @@
 # preliminary bash completion support for lei (Local Email Interface)
 # Needs a lot of work, see `lei__complete' in lib/PublicInbox::LEI.pm
 _lei() {
-        case ${COMP_WORDS[@]} in
-        *' add-external h'* | *' --mirror h'*)
-                compopt -o nospace
-                ;;
+        local wordlist="$(lei _complete ${COMP_WORDS[@]})"
+        case $wordlist in
+        *':'* | *'='* | '//'*) compopt -o nospace ;;
         *) compopt +o nospace ;; # the default
         esac
-        COMPREPLY=($(compgen -W "$(lei _complete ${COMP_WORDS[@]})" \
-                        -- "${COMP_WORDS[COMP_CWORD]}"))
+        COMPREPLY=($(compgen -W "$wordlist" -- "${COMP_WORDS[COMP_CWORD]}"))
         return 0
 }
 complete -o default -o bashdefault -F _lei lei