-
Notifications
You must be signed in to change notification settings - Fork 151
/
custom.go
39 lines (34 loc) · 925 Bytes
/
custom.go
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
package help
import (
"context"
"reflect"
"github.com/scaleway/scaleway-cli/v2/internal/core"
)
func GetCommands() *core.Commands {
return core.NewCommands(
helpRoot(),
newHelpCommand("output", shortOutput, longOutput),
newHelpCommand("date", shortDate, longDate),
)
}
func helpRoot() *core.Command {
return &core.Command{
Short: "Get help about how the CLI works",
Namespace: "help",
AllowAnonymousClient: true,
}
}
func newHelpCommand(resource string, short string, long string) *core.Command {
return &core.Command{
Short: short,
Long: long,
Namespace: "help",
Resource: resource,
AllowAnonymousClient: true,
ArgsType: reflect.TypeOf(struct{}{}),
ArgSpecs: core.ArgSpecs{},
Run: func(ctx context.Context, argsI interface{}) (interface{}, error) {
return long, nil
},
}
}