File: lei-completion.bash

package info (click to toggle)
public-inbox 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,152 kB
  • sloc: perl: 52,771; sh: 302; ansic: 106; makefile: 37
file content (16 lines) | stat: -rw-r--r-- 648 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>

# preliminary bash completion support for lei (Local Email Interface)
# Needs a lot of work, see `lei__complete' in lib/PublicInbox::LEI.pm
_lei() {
	local wordlist="$(lei _complete ${COMP_WORDS[@]})"
	case $wordlist in
	*':'* | *'='* | '//'*) compopt -o nospace ;;
	*) compopt +o nospace ;; # the default
	esac
	wordlist="${wordlist//;/\\\\;}" # escape ';' for ';UIDVALIDITY' and such
	COMPREPLY=($(compgen -W "$wordlist" -- "${COMP_WORDS[COMP_CWORD]}"))
	return 0
}
complete -o default -o bashdefault -F _lei lei