⛔ DEPRECATION WARNING: Use conf instead.
This config
Bonzai branch is for safely managing any configuration as
single, local YAML/JSON using industry standards for local configuration
and system-safe writes. Use it to add a config
subcommand to any other
Bonzai command, or to your root Bonzai tree (z
). All commands that use
config
that are composed into a single binary, no matter where in the
tree, will use the same local config file even though the position
within the file will be qualified by the tree location.
By default, importing config
will assigned a new implementation of
bonzai.Configurer
to Z.Conf
(satisfying any Z.Cmd
requirement for
configuration) and will use the name of the binary (Z.ExeName
) as the
directory name within os.UserConfDir
with a config.yaml
file name.
To override this behavior, create a new pkd/config.Conf
struct assign
Id
, Dir
and File
, and then assign that to Z.Conf
.
This command can be installed as a standalone program (for combined use with shell scripts perhaps) or composed into a Bonzai command tree.
Standalone
go install github.com/rwxrob/config/config@latest
Composed
package z
import (
Z "github.com/rwxrob/bonzai"
"github.com/rwxrob/config"
)
var Cmd = &bonzai.Cmd{
Name: `z`,
Commands: []*Z.Cmd{help.Cmd, config.Cmd},
}
Note config is designed to be composed only in monolith mode (not multicall binary).
To activate bash completion just use the complete -C
option from your
.bashrc
or command line. There is no messy sourcing required. All the
completion is done by the program itself.
complete -C config config
If you don't have bash or tab completion check use the shortcut commands instead.
All documentation (like manual pages) has been embedded into the source code of the application. See the source or run the program with help to access it.
- JSON Output. JSON is YAML. But JSON is also much safer to deal
with when parsing and piping into other things. The
Query
form has been modeled afterjq
(which has become something of a standard tool for mining information from configuration and other files.