2023-06-15 21:22:51 +08:00
|
|
|
//
|
|
|
|
// cli_base.go
|
|
|
|
// Copyright (C) 2022 tiglog <me@tiglog.com>
|
|
|
|
//
|
|
|
|
// Distributed under terms of the MIT license.
|
|
|
|
//
|
|
|
|
|
2023-10-15 00:54:45 +08:00
|
|
|
package gconsole
|
2023-06-15 21:22:51 +08:00
|
|
|
|
|
|
|
import "flag"
|
|
|
|
|
|
|
|
type BaseCmd struct {
|
|
|
|
Name string
|
|
|
|
Desc string
|
|
|
|
FlagSet *flag.FlagSet
|
|
|
|
Action ActionHandler
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *BaseCmd) GetName() string {
|
|
|
|
return c.Name
|
|
|
|
}
|
|
|
|
func (c *BaseCmd) GetDesc() string {
|
|
|
|
return c.Desc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *BaseCmd) GetAction() ActionHandler {
|
|
|
|
return c.Action
|
|
|
|
}
|