diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-29 19:05:49 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-29 19:05:49 +0200 |
| commit | e4aa085a74b10cdb74d0ea2aa5105da7de397aa4 (patch) | |
| tree | 426fcf702b6bed44bf5e29227eb75aed24d91c70 /assets/qtmaildir.bash-completion | |
| parent | bed9d291370b2b198b2d146c7081066b6dd70641 (diff) | |
| download | qtmaildir-e4aa085a74b10cdb74d0ea2aa5105da7de397aa4.tar.gz qtmaildir-e4aa085a74b10cdb74d0ea2aa5105da7de397aa4.zip | |
feat: bash completion for the launch selectors
Completes the options, and the account keys after --account, read from the
[account.<key>] sections of the config the application itself reads. Thread
and message ids are deliberately not completed: offering them means querying
the whole notmuch index on every Tab, which on a real Maildir is tens of
thousands of ids nobody would pick from a list anyway.
Installed under share/bash-completion/completions, where bash-completion
loads a command's file on demand by name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'assets/qtmaildir.bash-completion')
| -rw-r--r-- | assets/qtmaildir.bash-completion | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/assets/qtmaildir.bash-completion b/assets/qtmaildir.bash-completion new file mode 100644 index 0000000..a203be8 --- /dev/null +++ b/assets/qtmaildir.bash-completion @@ -0,0 +1,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 |
