Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Delete = app.Register(&app.Command[app.Empty, app.Empty]{ Use: "builder {name}", Desc: "Delete a builder", Action: "Delete", PrepareNoFlag: func(cmd *cobra.Command) { cmd.Args = cobra.ExactArgs(1) cmd.ValidArgsFunction = app.Comp(app.CompBuilder) }, Run: func(ctx *app.Context[app.Empty, app.Empty]) error { name := ctx.Arg(0) path := config.GetDir("builders", name+".yaml") return app.Delete(ctx.Arg(0), path) }, })
View Source
var Edit = app.Register(&app.Command[app.Empty, app.Empty]{ Use: "builder {builder}", Desc: "Edit builder file", Action: "Edit", PrepareNoFlag: func(cmd *cobra.Command) { cmd.Args = cobra.ExactArgs(1) cmd.ValidArgsFunction = app.Comp(app.CompBuilder) }, Run: func(ctx *app.Context[app.Empty, app.Empty]) error { name := fmt.Sprintf("%s.yaml", ctx.Arg(0)) path := config.GetDir("builders", name) return app.Edit(path, config.DefaultBuilder, name, func(s string) error { data := []byte(s) var builder core.Builder err := yaml.Unmarshal(data, &builder) if err != nil { return errors.Trace(err, "parse yaml") } return builder.Validate() }) }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.