diff options
Diffstat (limited to 'commands/commands.go')
-rw-r--r-- | commands/commands.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/commands/commands.go b/commands/commands.go index 8d50b417..e53bdfe8 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -3,6 +3,7 @@ package commands import ( "errors" "strings" + "unicode" "github.com/google/shlex" @@ -108,3 +109,25 @@ func (cmds *Commands) GetCompletions(aerc *widgets.Aerc, cmd string) []string { } return nil } + +const caps string = "ABCDEFGHIJKLMNOPQRSTUVXYZ" + +func GetFolders(aerc *widgets.Aerc, args []string) []string { + out := make([]string, 0) + lower_only := false + for _, rune := range args[0] { + lower_only = lower_only || unicode.IsLower(rune) + } + + for _, dir := range aerc.SelectedAccount().Directories().List() { + test := dir + if lower_only { + test = strings.ToLower(dir) + } + + if strings.HasPrefix(test, args[0]) { + out = append(out, dir) + } + } + return out +} |