aboutsummaryrefslogtreecommitdiffstats
path: root/commands/commands.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-10-09 13:52:20 +0200
committerRobin Jarry <robin@jarry.cc>2023-10-10 11:37:56 +0200
commit598e4a5803578ab3e291f232d6aad31b4efd8ea4 (patch)
treec55e16d60e2c3eea2d6de27d1bac18db5670ec77 /commands/commands.go
parent61bca76423ee87bd59084a146eca71c6bae085e1 (diff)
downloadaerc-598e4a5803578ab3e291f232d6aad31b4efd8ea4.tar.gz
widgets: rename package to app
This is the central point of all aerc. Having it named widgets is confusing. Rename it to app. It will make a cleaner transition when making the app.Aerc object available globally in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'commands/commands.go')
-rw-r--r--commands/commands.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/commands/commands.go b/commands/commands.go
index 9366be9c..0971d478 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -9,18 +9,18 @@ import (
"github.com/google/shlex"
+ "git.sr.ht/~rjarry/aerc/app"
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/lib/templates"
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
- "git.sr.ht/~rjarry/aerc/widgets"
)
type Command interface {
Aliases() []string
- Execute(*widgets.Aerc, []string) error
- Complete(*widgets.Aerc, []string) []string
+ Execute(*app.Aerc, []string) error
+ Complete(*app.Aerc, []string) []string
}
type OptionsProvider interface {
@@ -30,7 +30,7 @@ type OptionsProvider interface {
type OptionCompleter interface {
OptionsProvider
- CompleteOption(*widgets.Aerc, rune, string) []string
+ CompleteOption(*app.Aerc, rune, string) []string
}
type Commands map[string]Command
@@ -81,7 +81,7 @@ type CommandSource interface {
}
func templateData(
- aerc *widgets.Aerc,
+ aerc *app.Aerc,
cfg *config.AccountConfig,
msg *models.MessageInfo,
) models.TemplateData {
@@ -112,7 +112,7 @@ func templateData(
}
func (cmds *Commands) ExecuteCommand(
- aerc *widgets.Aerc,
+ aerc *app.Aerc,
origArgs []string,
account *config.AccountConfig,
msg *models.MessageInfo,
@@ -178,7 +178,7 @@ func expand(data models.TemplateData, origArgs []string) ([]string, error) {
}
func GetTemplateCompletion(
- aerc *widgets.Aerc, cmd string,
+ aerc *app.Aerc, cmd string,
) ([]string, string, bool) {
args, err := splitCmd(cmd)
if err != nil || len(args) == 0 {
@@ -231,7 +231,7 @@ func GetTemplateCompletion(
// GetCompletions returns the completion options and the command prefix
func (cmds *Commands) GetCompletions(
- aerc *widgets.Aerc, cmd string,
+ aerc *app.Aerc, cmd string,
) (options []string, prefix string) {
log.Tracef("completing command: %s", cmd)
@@ -323,7 +323,7 @@ func (cmds *Commands) GetCompletions(
return
}
-func GetFolders(aerc *widgets.Aerc, args []string) []string {
+func GetFolders(aerc *app.Aerc, args []string) []string {
acct := aerc.SelectedAccount()
if acct == nil {
return make([]string, 0)
@@ -336,14 +336,14 @@ func GetFolders(aerc *widgets.Aerc, args []string) []string {
// CompletionFromList provides a convenience wrapper for commands to use in the
// Complete function. It simply matches the items provided in valid
-func CompletionFromList(aerc *widgets.Aerc, valid []string, args []string) []string {
+func CompletionFromList(aerc *app.Aerc, valid []string, args []string) []string {
if len(args) == 0 {
return valid
}
return FilterList(valid, args[0], "", aerc.SelectedAccountUiConfig().FuzzyComplete)
}
-func GetLabels(aerc *widgets.Aerc, args []string) []string {
+func GetLabels(aerc *app.Aerc, args []string) []string {
acct := aerc.SelectedAccount()
if acct == nil {
return make([]string, 0)