config

package module
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 5 Imported by: 3

README

🌳 Go YAML/JSON Configuration

Go Version GoDoc License

This config Bonzai branch is for safely managing any configuration as single, local YAML/JSON using industry standards for local configuration. 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.

Install

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).

Tab Completion

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.

Embedded Documentation

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.

Design Considerations

  • 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 after jq (which has become something of a standard tool for mining information from configuration and other files.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &Z.Cmd{

	Name:      `config`,
	Summary:   `manage local YAML/JSON configuation`,
	Version:   `v0.0.1`,
	Copyright: `Copyright 2021 Robert S Muhlestein`,
	License:   `Apache-2.0`,
	Commands:  []*Z.Cmd{data, _init, edit, _file, query, help.Cmd},
	Description: `
		The *config* Bonzai branch is for safely managing any configuration
		as single, local YAML/JSON using industry standards for local
		configuration. Use it to add a *config* subcommand to any other
		Bonzai command, or to your root Bonzai tree (*z*).

		Take particular note that all commands 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. Therefore, any composite command can read the
		configurations of any other composite command within the same
		binary. This is by design, but all commands composed together should
		always be vetted for safe practices. This is also the reason there
		is no "write" or "set" command.

		All changes to configuration values are done via the *edit* command
		since configurations may be complex and deeply nested in some cases
		and promoting the automatic changing of configuration values opens
		the possibility of one buggy composed command to blow away one or
		all the configurations for everything composed into the binary. [The
		*cache* command is recommended when wanting to persist local data
		between command executions.]

		Querying configuration data can be easily accomplished with the
		<query> command that uses jq-like selection syntax.`,
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package config helps generically manage configuration data in YAML files (and, by extension JSON, which is a YAML subset) using the gopkg.in/yaml.v3 package (v2 is not compatible with encoding/json creating unexpected marshaling errors).
Package config helps generically manage configuration data in YAML files (and, by extension JSON, which is a YAML subset) using the gopkg.in/yaml.v3 package (v2 is not compatible with encoding/json creating unexpected marshaling errors).

Jump to

Keyboard shortcuts

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