aboutsummaryrefslogtreecommitdiffstats
path: root/modules/communication/neomutt/neomutt-sync.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'modules/communication/neomutt/neomutt-sync.zsh')
-rw-r--r--modules/communication/neomutt/neomutt-sync.zsh21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/communication/neomutt/neomutt-sync.zsh b/modules/communication/neomutt/neomutt-sync.zsh
new file mode 100644
index 0000000..03c092a
--- /dev/null
+++ b/modules/communication/neomutt/neomutt-sync.zsh
@@ -0,0 +1,21 @@
+#compdef neomutt-sync
+# Zsh completion for the neomutt-sync command.
+# Completes mbsync channel names parsed from the mbsyncrc
+# (defaults to ~/.config/mbsync/.mbsyncrc, overridable via MBSYNCRC).
+
+_arguments '1: :->channel'
+
+case $state in
+ channel)
+ local mbsyncrc="${MBSYNCRC:-$HOME/.config/mbsync/.mbsyncrc}"
+ local -a channels
+ while IFS= read -r channel; do
+ case $channel in
+ *-quick) channels+=("$channel:Quick sync of INBOX only (new mail); run from the neomutt gs macro") ;;
+ *-full) channels+=("$channel:Full two-way sync of all folders (slow); for scheduled runs") ;;
+ *) channels+=("$channel") ;;
+ esac
+ done < <(grep -oP '^Channel\s+\K\S+' "$mbsyncrc" 2>/dev/null | sort -u)
+ _describe 'channel' channels
+ ;;
+esac