diff options
Diffstat (limited to 'extra')
-rw-r--r-- | extra/completion/alot-completion.zsh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/extra/completion/alot-completion.zsh b/extra/completion/alot-completion.zsh index bbd3c54d..34d48a61 100644 --- a/extra/completion/alot-completion.zsh +++ b/extra/completion/alot-completion.zsh @@ -24,6 +24,18 @@ _alot_search() '--sort=[sort results]:sorting:((newest_first\:"reverse chronological order" oldest_first\:"chronological order" message_id\:"lexicographically by Message Id"))' } +_alot_account_emails() +{ + python3 - ${XDG_CONFIG_HOME:-~/.config}/alot/config <<-'EOF' + import configobj, sys + config = configobj.ConfigObj(infile=sys.argv[1], encoding="UTF8") + accounts = config.get("accounts", {}) + addresses = [accounts[k].get('address') for k in accounts + if type(accounts[k]) is configobj.Section] + print(" ".join(addresses), end="") + EOF +} + _alot_compose() { _arguments -s : \ @@ -31,7 +43,7 @@ _alot_compose() '--bcc=[Blind Carbon Copy header]:Recipient (Bcc header):_email_addresses' \ '--cc=[Carbon Copy header]:Recipient (Cc header):_email_addresses' \ '--omit_signature[do not add signature]' \ - '--sender=[From header]' \ + "--sender=[From header]:Sender account:($(_alot_account_emails))" \ '--subject=[Subject header]' \ '--template=[template file to use]' \ '--to=[To header]:Recipient (To header):_email_addresses' \ |