Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.BaseDir("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 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.BaseDir("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") }) }, })
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.