Debian Codegraph @

commands/patch/term.go

raw
1 package patch
2
3 import (
4 "git.sr.ht/~rjarry/aerc/commands"
5 "git.sr.ht/~rjarry/aerc/lib/pama"
6 )
7
8 type Term struct {
9 Cmd []string `opt:"..." required:"false"`
10 }
11
12 func init() {
13 register(Term{})
14 }
15
16 func (Term) Description() string {
17 return "Open a shell or run a command in the current project's directory."
18 }
19
20 func (Term) Context() commands.CommandContext {
21 return commands.GLOBAL
22 }
23
24 func (Term) Aliases() []string {
25 return []string{"term"}
26 }
27
28 func (t Term) Execute(_ []string) error {
29 p, err := pama.New().CurrentProject()
30 if err != nil {
31 return err
32 }
33 return commands.TermCoreDirectory(t.Cmd, p.Root)
34 }