]> Sergey Matveev's repositories - public-inbox.git/blob - contrib/completion/lei-completion.bash
lei import: support shell completion of known folders
[public-inbox.git] / contrib / completion / lei-completion.bash
1 # Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # preliminary bash completion support for lei (Local Email Interface)
5 # Needs a lot of work, see `lei__complete' in lib/PublicInbox::LEI.pm
6 _lei() {
7         local wordlist="$(lei _complete ${COMP_WORDS[@]})"
8         case $wordlist in
9         *':'* | *'='* | '//'*) compopt -o nospace ;;
10         *) compopt +o nospace ;; # the default
11         esac
12         wordlist="${wordlist//;/\\\\;}" # escape ';' for ';UIDVALIDITY' and such
13         COMPREPLY=($(compgen -W "$wordlist" -- "${COMP_WORDS[COMP_CWORD]}"))
14         return 0
15 }
16 complete -o default -o bashdefault -F _lei lei