-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdirectory_command.go
More file actions
42 lines (32 loc) · 1010 Bytes
/
directory_command.go
File metadata and controls
42 lines (32 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package exoskeleton
import (
"path/filepath"
"github.com/square/exoskeleton/v2/pkg/shellcomp"
)
type directoryCommand struct {
executableCommand
cmds Commands
discoverer DiscoveryContext
}
func (m *directoryCommand) Exec(e *Entrypoint, args, env []string) error {
return e.printModuleHelp(m, args)
}
func (m *directoryCommand) Complete(_ *Entrypoint, args, _ []string) ([]string, shellcomp.Directive, error) {
return completionsForSubcommands(m, args)
}
func (m *directoryCommand) Summary() (string, error) {
return m.cache.Fetch(m, "summary", func() (string, error) {
return readSummaryFromModulefile(m)
})
}
func (m *directoryCommand) Help() (string, error) {
panic("Unused")
}
func (m *directoryCommand) DefaultSubcommand() Command { return nil }
func (m *directoryCommand) Subcommands() (Commands, error) {
if m.cmds == nil && m.discoverer != nil {
m.cmds, _ = m.discoverer.DiscoverIn(filepath.Dir(m.path), m)
// TODO: return errors from discovery
}
return m.cmds, nil
}