Documentation ¶
Index ¶
- type AppCtx
- func (app *AppCtx) AddCommand(use string, fn func(args ...string), cmdOpts ...func(*cobra.Command))
- func (app *AppCtx) Conf(config interface{}) error
- func (app *AppCtx) Run(jobs ...launcher.IJob)
- func (app *AppCtx) RunContext(ctx context.Context, jobs ...launcher.IJob)
- func (app *AppCtx) WithOptions(opts ...AppCtxOption) *AppCtx
- type AppCtxOption
- type ProjectInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppCtx ¶ added in v0.5.0
type AppCtx struct {
// contains filtered or unexported fields
}
AppCtx 配置文件管理器
func (*AppCtx) AddCommand ¶ added in v0.5.0
AddCommand 添加子命令 ex: AddCommand(migrate, module.Migrate())
cmdOpts can be flags options ex:
func WithFlags(flag string) func(*cobra.Command) { return func(cmd *cobra.Command) { cmd.Flags().StringVarP(&flag, "targets", "t", "nothing", "specify targets") } }
func (*AppCtx) RunContext ¶ added in v0.5.0
RunContext 启动服务
func (*AppCtx) WithOptions ¶ added in v0.5.0
func (app *AppCtx) WithOptions(opts ...AppCtxOption) *AppCtx
type AppCtxOption ¶ added in v0.5.0
type AppCtxOption = func(app *AppCtx)
func WithHelpMode ¶ added in v0.5.0
func WithHelpMode() AppCtxOption
func WithRoot ¶ added in v0.5.0
func WithRoot(root string) AppCtxOption
WithRoot 指定项目根目录, 即 go.mod 所在的目录。
root 可以是相对 main.go 的相对路径, 也是可以是绝对路径
type ProjectInfo ¶
type ProjectInfo struct { Name string `flag:"name" usage:"project name"` Workdir string `flag:"dir" usage:"project src path, \ndefault: <project_name>"` PkgName string `flag:"pkg" usage:"go module name, \ndefault: github.com/go-jarvis/<project_name>"` }
var Project *ProjectInfo
var makefile = tmpl.GetFile("Makefile")
func (*ProjectInfo) CreateProject ¶
func (info *ProjectInfo) CreateProject()
CreateProject create a new project
Click to show internal directories.
Click to hide internal directories.