aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msgview
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msgview')
-rw-r--r--commands/msgview/close.go4
-rw-r--r--commands/msgview/next-part.go4
-rw-r--r--commands/msgview/next.go4
-rw-r--r--commands/msgview/open-link.go6
-rw-r--r--commands/msgview/open.go4
-rw-r--r--commands/msgview/save.go12
-rw-r--r--commands/msgview/toggle-headers.go4
-rw-r--r--commands/msgview/toggle-key-passthrough.go4
8 files changed, 8 insertions, 34 deletions
diff --git a/commands/msgview/close.go b/commands/msgview/close.go
index 32702da9..95960ef3 100644
--- a/commands/msgview/close.go
+++ b/commands/msgview/close.go
@@ -14,10 +14,6 @@ func (Close) Aliases() []string {
return []string{"close"}
}
-func (Close) Complete(args []string) []string {
- return nil
-}
-
func (Close) Execute(args []string) error {
mv, _ := app.SelectedTabContent().(*app.MessageViewer)
app.RemoveTab(mv, true)
diff --git a/commands/msgview/next-part.go b/commands/msgview/next-part.go
index 9b1b1fcc..77eb008d 100644
--- a/commands/msgview/next-part.go
+++ b/commands/msgview/next-part.go
@@ -16,10 +16,6 @@ func (NextPrevPart) Aliases() []string {
return []string{"next-part", "prev-part"}
}
-func (NextPrevPart) Complete(args []string) []string {
- return nil
-}
-
func (np NextPrevPart) Execute(args []string) error {
mv, _ := app.SelectedTabContent().(*app.MessageViewer)
for n := 0; n < np.Offset; n++ {
diff --git a/commands/msgview/next.go b/commands/msgview/next.go
index d8f046f8..c953cd5d 100644
--- a/commands/msgview/next.go
+++ b/commands/msgview/next.go
@@ -39,10 +39,6 @@ func (NextPrevMsg) Aliases() []string {
return []string{"next", "next-message", "prev", "prev-message"}
}
-func (NextPrevMsg) Complete(args []string) []string {
- return nil
-}
-
func (np NextPrevMsg) Execute(args []string) error {
cmd := account.NextPrevMsg{Amount: np.Amount, Percent: np.Percent}
err := cmd.Execute(args)
diff --git a/commands/msgview/open-link.go b/commands/msgview/open-link.go
index 55aee08c..eceb4232 100644
--- a/commands/msgview/open-link.go
+++ b/commands/msgview/open-link.go
@@ -11,7 +11,7 @@ import (
)
type OpenLink struct {
- Url *url.URL `opt:"url" action:"ParseUrl"`
+ Url *url.URL `opt:"url" action:"ParseUrl" complete:"CompleteUrl"`
Cmd string `opt:"..." required:"false"`
}
@@ -23,11 +23,11 @@ func (OpenLink) Aliases() []string {
return []string{"open-link"}
}
-func (OpenLink) Complete(args []string) []string {
+func (*OpenLink) CompleteUrl(arg string) []string {
mv := app.SelectedTabContent().(*app.MessageViewer)
if mv != nil {
if p := mv.SelectedMessagePart(); p != nil {
- return commands.CompletionFromList(p.Links, args)
+ return commands.CompletionFromList(p.Links, arg)
}
}
return nil
diff --git a/commands/msgview/open.go b/commands/msgview/open.go
index 0d6db5b0..a8443404 100644
--- a/commands/msgview/open.go
+++ b/commands/msgview/open.go
@@ -29,10 +29,6 @@ func (Open) Aliases() []string {
return []string{"open"}
}
-func (Open) Complete(args []string) []string {
- return nil
-}
-
func (o Open) Execute(args []string) error {
mv := app.SelectedTabContent().(*app.MessageViewer)
if mv == nil {
diff --git a/commands/msgview/save.go b/commands/msgview/save.go
index ea7599d3..9f2b71fc 100644
--- a/commands/msgview/save.go
+++ b/commands/msgview/save.go
@@ -22,7 +22,7 @@ type Save struct {
CreateDirs bool `opt:"-p"`
Attachments bool `opt:"-a"`
AllAttachments bool `opt:"-A"`
- Path string `opt:"..." required:"false" metavar:"<path>"`
+ Path string `opt:"path" required:"false" complete:"CompletePath"`
}
func init() {
@@ -37,14 +37,12 @@ func (Save) Aliases() []string {
return []string{"save"}
}
-func (s Save) Complete(args []string) []string {
- trimmed := commands.Operands(args, s.Options())
- path := strings.Join(trimmed, " ")
+func (*Save) CompletePath(arg string) []string {
defaultPath := config.General.DefaultSavePath
- if defaultPath != "" && !isAbsPath(path) {
- path = filepath.Join(defaultPath, path)
+ if defaultPath != "" && !isAbsPath(arg) {
+ arg = filepath.Join(defaultPath, arg)
}
- return commands.CompletePath(xdg.ExpandHome(path))
+ return commands.CompletePath(xdg.ExpandHome(arg))
}
func (s Save) Execute(args []string) error {
diff --git a/commands/msgview/toggle-headers.go b/commands/msgview/toggle-headers.go
index c27307d3..37f5b22f 100644
--- a/commands/msgview/toggle-headers.go
+++ b/commands/msgview/toggle-headers.go
@@ -14,10 +14,6 @@ func (ToggleHeaders) Aliases() []string {
return []string{"toggle-headers"}
}
-func (ToggleHeaders) Complete(args []string) []string {
- return nil
-}
-
func (ToggleHeaders) Execute(args []string) error {
mv, _ := app.SelectedTabContent().(*app.MessageViewer)
mv.ToggleHeaders()
diff --git a/commands/msgview/toggle-key-passthrough.go b/commands/msgview/toggle-key-passthrough.go
index 32735870..b4c5f2c7 100644
--- a/commands/msgview/toggle-key-passthrough.go
+++ b/commands/msgview/toggle-key-passthrough.go
@@ -15,10 +15,6 @@ func (ToggleKeyPassthrough) Aliases() []string {
return []string{"toggle-key-passthrough"}
}
-func (ToggleKeyPassthrough) Complete(args []string) []string {
- return nil
-}
-
func (ToggleKeyPassthrough) Execute(args []string) error {
mv, _ := app.SelectedTabContent().(*app.MessageViewer)
keyPassthroughEnabled := mv.ToggleKeyPassthrough()