...
1 package rootcmd
2
3 import (
4 "context"
5 "flag"
6
7 "github.com/peterbourgon/ff/v3/ffcli"
8 "github.com/peterbourgon/ff/v3/ffcli/examples/objectctl/pkg/objectapi"
9 )
10
11
12
13 type Config struct {
14 Token string
15 Verbose bool
16
17 Client *objectapi.Client
18 }
19
20
21
22
23 func New() (*ffcli.Command, *Config) {
24 var cfg Config
25
26 fs := flag.NewFlagSet("objectctl", flag.ExitOnError)
27 cfg.RegisterFlags(fs)
28
29 return &ffcli.Command{
30 Name: "objectctl",
31 ShortUsage: "objectctl [flags] <subcommand> [flags] [<arg>...]",
32 FlagSet: fs,
33 Exec: cfg.Exec,
34 }, &cfg
35 }
36
37
38
39
40
41 func (c *Config) RegisterFlags(fs *flag.FlagSet) {
42 fs.StringVar(&c.Token, "token", "", "secret token for object API")
43 fs.BoolVar(&c.Verbose, "v", false, "log verbose output")
44 }
45
46
47 func (c *Config) Exec(context.Context, []string) error {
48
49
50 return flag.ErrHelp
51 }
52
View as plain text