diff options
Diffstat (limited to 'commands/msg/read.go')
-rw-r--r-- | commands/msg/read.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/commands/msg/read.go b/commands/msg/read.go index e55ed00e..72159a53 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -6,6 +6,7 @@ import ( "time" "git.sr.ht/~rjarry/aerc/app" + "git.sr.ht/~rjarry/aerc/commands" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -13,7 +14,7 @@ import ( type FlagMsg struct { Toggle bool `opt:"-t"` Answered bool `opt:"-a" aliases:"flag,unflag"` - Flag models.Flags `opt:"-x" aliases:"flag,unflag" action:"ParseFlag"` + Flag models.Flags `opt:"-x" aliases:"flag,unflag" action:"ParseFlag" complete:"CompleteFlag"` FlagName string } @@ -25,10 +26,6 @@ func (FlagMsg) Aliases() []string { return []string{"flag", "unflag", "read", "unread"} } -func (FlagMsg) Complete(args []string) []string { - return nil -} - func (f *FlagMsg) ParseFlag(arg string) error { switch strings.ToLower(arg) { case "seen": @@ -46,6 +43,12 @@ func (f *FlagMsg) ParseFlag(arg string) error { return nil } +var validFlags = []string{"seen", "answered", "flagged"} + +func (*FlagMsg) CompleteFlag(arg string) []string { + return commands.CompletionFromList(validFlags, arg) +} + // If this was called as 'flag' or 'unflag', without the toggle (-t) // option, then it will flag the corresponding messages with the given // flag. If the toggle option was given, it will individually toggle |