msg/archive: complete the possible options
This commit is contained in:
parent
2b53347d0d
commit
1fbce012ed
|
@ -128,6 +128,21 @@ func GetFolders(aerc *widgets.Aerc, args []string) []string {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CompletionFromList provides a convenience wrapper for commands to use in the
|
||||||
|
// Complete function. It simply matches the items provided in valid
|
||||||
|
func CompletionFromList(valid []string, args []string) []string {
|
||||||
|
out := make([]string, 0)
|
||||||
|
if len(args) == 0 {
|
||||||
|
return valid
|
||||||
|
}
|
||||||
|
for _, v := range valid {
|
||||||
|
if hasCaseSmartPrefix(v, args[0]) {
|
||||||
|
out = append(out, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
func GetLabels(aerc *widgets.Aerc, args []string) []string {
|
func GetLabels(aerc *widgets.Aerc, args []string) []string {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
return aerc.SelectedAccount().Labels()
|
return aerc.SelectedAccount().Labels()
|
||||||
|
|
|
@ -32,7 +32,8 @@ func (Archive) Aliases() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Archive) Complete(aerc *widgets.Aerc, args []string) []string {
|
func (Archive) Complete(aerc *widgets.Aerc, args []string) []string {
|
||||||
return nil
|
valid := []string{"flat", "year", "month"}
|
||||||
|
return commands.CompletionFromList(valid, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
|
func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
|
|
Loading…
Reference in New Issue