Change search flags

This changes the search flags for maildir and imap backends.

They now no longer use -t for searching all text. This seems to make
more sense as being the targeted recipient. I have similarly added Cc
for -c. The text search now resides under -a for all text.
This commit is contained in:
Jeffas 2019-09-20 17:26:17 +01:00 committed by Drew DeVault
parent 39307a6fa7
commit d2a18e267c
3 changed files with 22 additions and 6 deletions

View File

@ -12,10 +12,14 @@ aerc-search(1)
*-b*: Search in the body of the messages *-b*: Search in the body of the messages
*-t*: Search in the entire text of the messages *-a*: Search in the entire text of the messages
*-f <from>*: Search for messages from <from> *-f <from>*: Search for messages from <from>
*-t <to>*: Search for messages to <to>
*-c <cc>*: Search for messages cc'ed to <cc>
# MAILDIR # MAILDIR
*search* [-rubt] [-f <from>] <terms...> *search* [-rubt] [-f <from>] <terms...>
@ -28,10 +32,14 @@ aerc-search(1)
*-b*: Search in the body of the messages *-b*: Search in the body of the messages
*-t*: Search in the entire text of the messages *-a*: Search in the entire text of the messages
*-f <from>*: Search for messages from <from> *-f <from>*: Search for messages from <from>
*-t <to>*: Search for messages to <to>
*-c <cc>*: Search for messages cc'ed to <cc>
# NOTMUCH # NOTMUCH
*search* <query...> *search* <query...>

View File

@ -9,7 +9,7 @@ import (
func parseSearch(args []string) (*imap.SearchCriteria, error) { func parseSearch(args []string) (*imap.SearchCriteria, error) {
criteria := imap.NewSearchCriteria() criteria := imap.NewSearchCriteria()
opts, optind, err := getopt.Getopts(args, "rubtH:f:") opts, optind, err := getopt.Getopts(args, "rubat:H:f:c:")
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -25,9 +25,13 @@ func parseSearch(args []string) (*imap.SearchCriteria, error) {
// TODO // TODO
case 'f': case 'f':
criteria.Header.Add("From", opt.Value) criteria.Header.Add("From", opt.Value)
case 't':
criteria.Header.Add("To", opt.Value)
case 'c':
criteria.Header.Add("Cc", opt.Value)
case 'b': case 'b':
body = true body = true
case 't': case 'a':
text = true text = true
} }
} }

View File

@ -29,7 +29,7 @@ func newSearchCriteria() *searchCriteria {
func parseSearch(args []string) (*searchCriteria, error) { func parseSearch(args []string) (*searchCriteria, error) {
criteria := newSearchCriteria() criteria := newSearchCriteria()
opts, optind, err := getopt.Getopts(args, "rubtH:f:") opts, optind, err := getopt.Getopts(args, "rubat:H:f:c:")
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -45,9 +45,13 @@ func parseSearch(args []string) (*searchCriteria, error) {
// TODO // TODO
case 'f': case 'f':
criteria.Header.Add("From", opt.Value) criteria.Header.Add("From", opt.Value)
case 't':
criteria.Header.Add("To", opt.Value)
case 'c':
criteria.Header.Add("Cc", opt.Value)
case 'b': case 'b':
body = true body = true
case 't': case 'a':
text = true text = true
} }
} }