vars

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &bonzai.Cmd{
	Name:  `var`,
	Alias: `vars`,
	Vers:  `v0.1.0`,
	Cmds: []*bonzai.Cmd{
		GetCmd, SetCmd, editCmd, initCmd, clearCmd,
		grepCmd, loadCmd, deleteCmd, dataCmd,
	},
	Comp: comp.Cmds,
	Def:  GetCmd,
}
View Source
var GetCmd = &bonzai.Cmd{
	Name:    `get`,
	Comp:    comp.Vars,
	NumArgs: 1,
	Call: func(_ *bonzai.Cmd, args ...string) error {
		value, err := vars.Data.Get(args[0])
		if err != nil {
			return err
		}
		term.Print(value)
		return nil
	},
}

can be imported directly into other Cmds without problem

View Source
var SetCmd = &bonzai.Cmd{
	Name:    `set`,
	Comp:    comp.Vars,
	MinArgs: 2,
	Call: func(_ *bonzai.Cmd, args ...string) error {
		return vars.Data.Set(args[0], strings.Join(args[1:], " "))
	},
}

can be imported directly into other Cmds without problem

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
var command

Jump to

Keyboard shortcuts

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