blob: a203be8043f425d03f2ea2617563545fe075808c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# bash completion for qtmaildir
#
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
# Licensed under the GNU General Public License version 2.
#
# Completes the options, and account keys after --account, read from the
# [account.<key>] sections of the config. Thread and message ids are NOT
# completed: listing them means querying the whole notmuch index on every Tab.
_qtmaildir()
{
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local conf=${XDG_CONFIG_HOME:-$HOME/.config}/qtmaildir/qtmaildir.conf
case $prev in
--account)
[[ -r $conf ]] || return
COMPREPLY=($(compgen -W "$(sed -n 's/^\[account\.\(.*\)\][[:space:]]*$/\1/p' "$conf")" -- "$cur"))
return ;;
--thread|--message)
return ;;
esac
COMPREPLY=($(compgen -W '--account --thread --message --help --version' -- "$cur"))
}
complete -F _qtmaildir qtmaildir
|