-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnull_command.go
More file actions
34 lines (27 loc) · 1.06 KB
/
null_command.go
File metadata and controls
34 lines (27 loc) · 1.06 KB
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
package exoskeleton
import (
"github.com/square/exit"
"github.com/square/exoskeleton/v2/pkg/shellcomp"
)
// nullCommand represents an unrecognized Command.
type nullCommand struct {
parent Command
name string
}
func (n nullCommand) Parent() Command { return n.parent }
func (_ nullCommand) Path() string { return "" }
func (n nullCommand) Name() string { return n.name }
func (_ nullCommand) Aliases() []string { return nil }
func (_ nullCommand) Summary() (string, error) { panic("Unused") }
func (_ nullCommand) Help() (string, error) { panic("Unused") }
func (n nullCommand) Exec(e *Entrypoint, _, _ []string) error {
return exit.ErrUnknownSubcommand
}
func (_ nullCommand) Complete(_ *Entrypoint, _, _ []string) ([]string, shellcomp.Directive, error) {
// Unable to find the real command. E.g., <program> someInvalidCmd <TAB>
return nil, shellcomp.DirectiveNoFileComp, nil
}
func (_ nullCommand) DefaultSubcommand() Command { return nil }
func (_ nullCommand) Subcommands() (Commands, error) {
return Commands{}, nil
}