mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-07-16 00:13:50 +02:00

Update the Command interface to include a Description() method. Implement the method for all commands using short descriptions inspired from the aerc(1) man page. Return the description values along with command names so that they can be displayed in completion choices. Implements: https://todo.sr.ht/~rjarry/aerc/271 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bojan Gabric <bojan@bojangabric.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
34 lines
613 B
Go
34 lines
613 B
Go
package patch
|
|
|
|
import (
|
|
"git.sr.ht/~rjarry/aerc/commands"
|
|
"git.sr.ht/~rjarry/aerc/lib/pama"
|
|
)
|
|
|
|
type Term struct {
|
|
Cmd []string `opt:"..." required:"false"`
|
|
}
|
|
|
|
func init() {
|
|
register(Term{})
|
|
}
|
|
|
|
func (Term) Description() string {
|
|
return "Open a shell or run a command in the current project's directory."
|
|
}
|
|
|
|
func (Term) Context() commands.CommandContext {
|
|
return commands.GLOBAL
|
|
}
|
|
|
|
func (Term) Aliases() []string {
|
|
return []string{"term"}
|
|
}
|
|
|
|
func (t Term) Execute(_ []string) error {
|
|
p, err := pama.New().CurrentProject()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return commands.TermCoreDirectory(t.Cmd, p.Root)
|
|
}
|