Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Builder = 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 Do(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() }) }, })
View Source
var Config = app.Register(&app.Command[app.Empty, app.Empty]{ Use: "config", Desc: "Edit config file", Action: "Edit", RunNoContext: func() error { path := config.GetDir("config.toml") return Do(path, config.DefaultConfig, "config.toml", func(s string) error { data := []byte(s) var cfg config.Config err := toml.Unmarshal(data, &cfg) return errors.Trace(err, "parse toml") }) }, })
View Source
var Job = app.Register(&app.Command[app.Empty, app.Empty]{ Use: "job {job}", Desc: "Edit job file", Action: "Edit", PrepareNoFlag: func(cmd *cobra.Command) { cmd.Args = cobra.ExactArgs(1) cmd.ValidArgsFunction = app.Comp(app.CompJob) }, Run: func(ctx *app.Context[app.Empty, app.Empty]) error { name := fmt.Sprintf("%s.sh", ctx.Arg(0)) path := config.GetDir("jobs", name) return Do(path, "", name, nil) }, })
View Source
var Remote = app.Register(&app.Command[app.Empty, app.Empty]{ Use: "remote {remote}", Desc: "Edit remote file", Action: "Edit", PrepareNoFlag: func(cmd *cobra.Command) { cmd.Args = cobra.ExactArgs(1) cmd.ValidArgsFunction = app.Comp(app.CompRemote) }, Run: func(ctx *app.Context[app.Empty, app.Empty]) error { name := fmt.Sprintf("%s.toml", ctx.Arg(0)) path := config.GetDir("remotes", name) return Do(path, config.DefaultRemote, name, func(s string) error { data := []byte(s) var remote core.Remote err := toml.Unmarshal(data, &remote) if err != nil { return errors.Trace(err, "parse toml") } err = validate.Do(&remote) return errors.Trace(err, "validate fields") }) }, })
View Source
var Workflow = app.Register(&app.Command[app.Empty, app.Empty]{ Use: "workflow {workflow}", Desc: "Edit workflow file", Action: "Edit", PrepareNoFlag: func(cmd *cobra.Command) { cmd.Args = cobra.ExactArgs(1) cmd.ValidArgsFunction = app.Comp(app.CompWorkflow) }, Run: func(ctx *app.Context[app.Empty, app.Empty]) error { name := fmt.Sprintf("%s.yaml", ctx.Arg(0)) path := config.GetDir("workflows", name) return Do(path, config.DefaultWorkflow, name, func(s string) error { data := []byte(s) var wf core.Workflow err := yaml.Unmarshal(data, &wf) if err != nil { return errors.Trace(err, "parse yaml") } return validate.Do(&wf) }) }, })
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.