Add breaking change to Configurer, returns error

pull/85/head
rwxrob 2 years ago
parent a1fc87eba6
commit de68606750
No known key found for this signature in database
GPG Key ID: 2B9111F33082AE77

@ -35,13 +35,13 @@ package bonzai
// ensure that the resulting values for edge matches can be used without
// needing a trim.
type Configurer interface {
Init() error // must initialize a new configuration
Data() string // must return full YAML
Print() // must print full YAML to os.Stdout
Edit() error // must open full YAML in local editor
OverWrite(with any) error // safely replace all configuration
Query(q string) string // yq compatible query string
QueryPrint(q string) // prints result to os.Stdout
Init() error // must initialize a new configuration
Data() (string, error) // must return full YAML
Print() error // must print full YAML to os.Stdout
Edit() error // must open full YAML in local editor
OverWrite(with any) error // safely replace all configuration
Query(q string) (string, error) // yq compatible query string
QueryPrint(q string) error // prints result to os.Stdout
}
// Vars specifies the package persistent variables driver interface. All

@ -522,12 +522,11 @@ func (x *Cmd) Log(format string, a ...any) {
}
// C is a shorter version of Z.Conf.Query(x.Path()+"."+q) for
// convenience. Logs the error and returns a blank string if Z.Conf is
// not defined (see UseConf).
func (x *Cmd) C(q string) string {
// convenience. See UseConf.
func (x *Cmd) C(q string) (string, error) {
if Conf == nil {
log.Printf("cmd %q requires a configurer (Z.Conf must be assigned)", x.Name)
return ""
return "", UsesConf{x}
}
path := x.Path()
if path != "." {

Loading…
Cancel
Save