aboutsummaryrefslogtreecommitdiffstats
path: root/commands/account
diff options
context:
space:
mode:
Diffstat (limited to 'commands/account')
-rw-r--r--commands/account/align.go2
-rw-r--r--commands/account/cf.go31
-rw-r--r--commands/account/clear.go2
-rw-r--r--commands/account/compose.go8
-rw-r--r--commands/account/export-mbox.go2
-rw-r--r--commands/account/import-mbox.go2
-rw-r--r--commands/account/mkdir.go2
-rw-r--r--commands/account/query.go8
-rw-r--r--commands/account/recover.go8
-rw-r--r--commands/account/rmdir.go4
-rw-r--r--commands/account/search.go26
-rw-r--r--commands/account/sort.go4
-rw-r--r--commands/account/view.go4
13 files changed, 46 insertions, 57 deletions
diff --git a/commands/account/align.go b/commands/account/align.go
index 83bb5b64..2c65b556 100644
--- a/commands/account/align.go
+++ b/commands/account/align.go
@@ -9,7 +9,7 @@ import (
)
type Align struct {
- Pos app.AlignPosition `opt:"pos" metavar:"top|center|bottom" action:"ParsePos" complete:"CompletePos"`
+ Pos app.AlignPosition `opt:"pos" metavar:"top|center|bottom" action:"ParsePos" complete:"CompletePos" desc:"Position."`
}
func init() {
diff --git a/commands/account/cf.go b/commands/account/cf.go
index 3cce37a3..8ec327ae 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -14,8 +14,8 @@ import (
)
type ChangeFolder struct {
- Account bool `opt:"-a"`
- Folder string `opt:"..." complete:"CompleteFolderAndNotmuch"`
+ Account string `opt:"-a" complete:"CompleteAccount" desc:"Change to specified account."`
+ Folder string `opt:"..." complete:"CompleteFolderAndNotmuch" desc:"Folder name."`
}
func init() {
@@ -34,20 +34,12 @@ func (ChangeFolder) Aliases() []string {
return []string{"cf"}
}
-func (c *ChangeFolder) CompleteFolderAndNotmuch(arg string) []string {
- var acct *app.AccountView
+func (c *ChangeFolder) CompleteAccount(arg string) []string {
+ return commands.FilterList(app.AccountNames(), arg, commands.QuoteSpace)
+}
- args := opt.LexArgs(c.Folder)
- if c.Account {
- accountName, _ := args.ArgSafe(0)
- if args.Count() <= 1 && arg == accountName {
- return commands.FilterList(
- app.AccountNames(), arg, commands.QuoteSpace)
- }
- acct, _ = app.Account(accountName)
- } else {
- acct = app.SelectedAccount()
- }
+func (c *ChangeFolder) CompleteFolderAndNotmuch(arg string) []string {
+ acct := app.SelectedAccount()
if acct == nil {
return nil
}
@@ -77,15 +69,12 @@ func (c *ChangeFolder) CompleteFolderAndNotmuch(arg string) []string {
func (c ChangeFolder) Execute([]string) error {
var target string
var acct *app.AccountView
+ var err error
args := opt.LexArgs(c.Folder)
- if c.Account {
- names, err := args.ShiftSafe(1)
- if err != nil {
- return errors.New("<account> is required. Usage: cf -a <account> <folder>")
- }
- acct, err = app.Account(names[0])
+ if c.Account != "" {
+ acct, err = app.Account(c.Account)
if err != nil {
return err
}
diff --git a/commands/account/clear.go b/commands/account/clear.go
index e16b563a..d45c5201 100644
--- a/commands/account/clear.go
+++ b/commands/account/clear.go
@@ -9,7 +9,7 @@ import (
)
type Clear struct {
- Selected bool `opt:"-s"`
+ Selected bool `opt:"-s" desc:"Select first message after clearing."`
}
func init() {
diff --git a/commands/account/compose.go b/commands/account/compose.go
index 9eeb339b..5e5d3e0f 100644
--- a/commands/account/compose.go
+++ b/commands/account/compose.go
@@ -16,10 +16,10 @@ import (
)
type Compose struct {
- Headers string `opt:"-H" action:"ParseHeader"`
- Template string `opt:"-T" complete:"CompleteTemplate"`
- Edit bool `opt:"-e"`
- NoEdit bool `opt:"-E"`
+ Headers string `opt:"-H" action:"ParseHeader" desc:"Add the specified header to the message."`
+ Template string `opt:"-T" complete:"CompleteTemplate" desc:"Template name."`
+ Edit bool `opt:"-e" desc:"Force [compose].edit-headers = true."`
+ NoEdit bool `opt:"-E" desc:"Force [compose].edit-headers = false."`
Body string `opt:"..." required:"false"`
}
diff --git a/commands/account/export-mbox.go b/commands/account/export-mbox.go
index fed8568e..529dbae0 100644
--- a/commands/account/export-mbox.go
+++ b/commands/account/export-mbox.go
@@ -19,7 +19,7 @@ import (
)
type ExportMbox struct {
- Filename string `opt:"filename" complete:"CompleteFilename"`
+ Filename string `opt:"filename" complete:"CompleteFilename" desc:"Output file path."`
}
func init() {
diff --git a/commands/account/import-mbox.go b/commands/account/import-mbox.go
index 946098e5..85101bc2 100644
--- a/commands/account/import-mbox.go
+++ b/commands/account/import-mbox.go
@@ -19,7 +19,7 @@ import (
)
type ImportMbox struct {
- Filename string `opt:"filename" complete:"CompleteFilename"`
+ Filename string `opt:"filename" complete:"CompleteFilename" desc:"Input file path."`
}
func init() {
diff --git a/commands/account/mkdir.go b/commands/account/mkdir.go
index cf8763be..76b8f2f8 100644
--- a/commands/account/mkdir.go
+++ b/commands/account/mkdir.go
@@ -11,7 +11,7 @@ import (
)
type MakeDir struct {
- Folder string `opt:"folder" complete:"CompleteFolder"`
+ Folder string `opt:"folder" complete:"CompleteFolder" desc:"Folder name."`
}
func init() {
diff --git a/commands/account/query.go b/commands/account/query.go
index da8a8c06..c30b2c78 100644
--- a/commands/account/query.go
+++ b/commands/account/query.go
@@ -11,10 +11,10 @@ import (
)
type Query struct {
- Account string `opt:"-a" complete:"CompleteAccount"`
- Name string `opt:"-n"`
- Force bool `opt:"-f"`
- Query string `opt:"..." complete:"CompleteNotmuch"`
+ Account string `opt:"-a" complete:"CompleteAccount" desc:"Account name."`
+ Name string `opt:"-n" desc:"Force name of virtual folder."`
+ Force bool `opt:"-f" desc:"Replace existing query if any."`
+ Query string `opt:"..." complete:"CompleteNotmuch" desc:"Notmuch query."`
}
func init() {
diff --git a/commands/account/recover.go b/commands/account/recover.go
index 625ac122..7f5b27f5 100644
--- a/commands/account/recover.go
+++ b/commands/account/recover.go
@@ -13,10 +13,10 @@ import (
)
type Recover struct {
- Force bool `opt:"-f"`
- Edit bool `opt:"-e"`
- NoEdit bool `opt:"-E"`
- File string `opt:"file" complete:"CompleteFile"`
+ Force bool `opt:"-f" desc:"Delete recovered file after opening the composer."`
+ Edit bool `opt:"-e" desc:"Force [compose].edit-headers = true."`
+ NoEdit bool `opt:"-E" desc:"Force [compose].edit-headers = false."`
+ File string `opt:"file" complete:"CompleteFile" desc:"Recover file path."`
}
func init() {
diff --git a/commands/account/rmdir.go b/commands/account/rmdir.go
index 852d717b..b7a99c18 100644
--- a/commands/account/rmdir.go
+++ b/commands/account/rmdir.go
@@ -13,8 +13,8 @@ import (
)
type RemoveDir struct {
- Force bool `opt:"-f"`
- Folder string `opt:"folder" complete:"CompleteFolder" required:"false"`
+ Force bool `opt:"-f" desc:"Remove the directory even if it contains messages."`
+ Folder string `opt:"folder" complete:"CompleteFolder" required:"false" desc:"Folder name."`
}
func init() {
diff --git a/commands/account/search.go b/commands/account/search.go
index 5dde3322..f64bcf91 100644
--- a/commands/account/search.go
+++ b/commands/account/search.go
@@ -19,20 +19,20 @@ import (
)
type SearchFilter struct {
- Read bool `opt:"-r" action:"ParseRead"`
- Unread bool `opt:"-u" action:"ParseUnread"`
- Body bool `opt:"-b"`
- All bool `opt:"-a"`
- UseExtension bool `opt:"-e"`
- Headers textproto.MIMEHeader `opt:"-H" action:"ParseHeader" metavar:"<header>:<value>"`
- WithFlags models.Flags `opt:"-x" action:"ParseFlag" complete:"CompleteFlag"`
- WithoutFlags models.Flags `opt:"-X" action:"ParseNotFlag" complete:"CompleteFlag"`
- To []string `opt:"-t" action:"ParseTo" complete:"CompleteAddress"`
- From []string `opt:"-f" action:"ParseFrom" complete:"CompleteAddress"`
- Cc []string `opt:"-c" action:"ParseCc" complete:"CompleteAddress"`
- StartDate time.Time `opt:"-d" action:"ParseDate" complete:"CompleteDate"`
+ Read bool `opt:"-r" action:"ParseRead" desc:"Search for read messages."`
+ Unread bool `opt:"-u" action:"ParseUnread" desc:"Search for unread messages."`
+ Body bool `opt:"-b" desc:"Search in the body of the messages."`
+ All bool `opt:"-a" desc:"Search in the entire text of the messages."`
+ UseExtension bool `opt:"-e" desc:"Use custom search backend extension."`
+ Headers textproto.MIMEHeader `opt:"-H" action:"ParseHeader" metavar:"<header>:<value>" desc:"Search for messages with the specified header."`
+ WithFlags models.Flags `opt:"-x" action:"ParseFlag" complete:"CompleteFlag" desc:"Search messages with specified flag."`
+ WithoutFlags models.Flags `opt:"-X" action:"ParseNotFlag" complete:"CompleteFlag" desc:"Search messages without specified flag."`
+ To []string `opt:"-t" action:"ParseTo" complete:"CompleteAddress" desc:"Search for messages To:<address>."`
+ From []string `opt:"-f" action:"ParseFrom" complete:"CompleteAddress" desc:"Search for messages From:<address>."`
+ Cc []string `opt:"-c" action:"ParseCc" complete:"CompleteAddress" desc:"Search for messages Cc:<address>."`
+ StartDate time.Time `opt:"-d" action:"ParseDate" complete:"CompleteDate" desc:"Search for messages within a particular date range."`
EndDate time.Time
- Terms string `opt:"..." required:"false" complete:"CompleteTerms"`
+ Terms string `opt:"..." required:"false" complete:"CompleteTerms" desc:"Search term."`
}
func init() {
diff --git a/commands/account/sort.go b/commands/account/sort.go
index 16060aa0..b381548c 100644
--- a/commands/account/sort.go
+++ b/commands/account/sort.go
@@ -13,8 +13,8 @@ import (
type Sort struct {
Unused struct{} `opt:"-"`
// these fields are only used for completion
- Reverse bool `opt:"-r"`
- Criteria []string `opt:"criteria" complete:"CompleteCriteria"`
+ Reverse bool `opt:"-r" desc:"Sort in the reverse order."`
+ Criteria []string `opt:"criteria" complete:"CompleteCriteria" desc:"Sort criterion."`
}
func init() {
diff --git a/commands/account/view.go b/commands/account/view.go
index 0e3ca09c..72f62b51 100644
--- a/commands/account/view.go
+++ b/commands/account/view.go
@@ -13,8 +13,8 @@ import (
)
type ViewMessage struct {
- Peek bool `opt:"-p"`
- Background bool `opt:"-b"`
+ Peek bool `opt:"-p" desc:"Peek message without marking it as read."`
+ Background bool `opt:"-b" desc:"Open message in a background tab."`
}
func init() {