remote

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 app.Edit(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

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL