Pass command name to CmdArgs struct
This commit is contained in:
parent
9360df727a
commit
d8be978ba8
@ -23,6 +23,7 @@ type CmdArgs struct {
|
|||||||
Flags Flags
|
Flags Flags
|
||||||
Client *lifx.Client
|
Client *lifx.Client
|
||||||
Config Config
|
Config Config
|
||||||
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Flags struct {
|
type Flags struct {
|
||||||
|
@ -237,6 +237,7 @@ func Main(args []string) (int, error) {
|
|||||||
fs.Parse(args[2:])
|
fs.Parse(args[2:])
|
||||||
|
|
||||||
cmdArgs.Flags = Flags{FlagSet: fs}
|
cmdArgs.Flags = Flags{FlagSet: fs}
|
||||||
|
cmdArgs.Name = command
|
||||||
exitCode, err := cmd.Func(cmdArgs)
|
exitCode, err := cmd.Func(cmdArgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("fatal: %s", err)
|
err = fmt.Errorf("fatal: %s", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user