mbconfig

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mbconfig centralizes Masterblaster configuration using Viper.

It provides XDG-compliant config directory resolution with the following precedence (highest to lowest):

  1. --config-dir CLI flag
  2. MB_CONFIG_DIR environment variable
  3. config.toml file in the config directory
  4. Default: $XDG_CONFIG_HOME/mb (falls back to ~/.config/mb)

The verbose flag follows the same pattern: --verbose flag > MB_VERBOSE env.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the resolved config directory path. Must be called after Init.

func Init

func Init(cmd *cobra.Command) error

Init binds Viper to the root command's persistent flags, sets the env prefix, applies defaults, and optionally reads a config.toml from the resolved config directory.

Call this from the root command's PersistentPreRunE so that flag values are parsed before Viper reads them.

func Verbose

func Verbose() bool

Verbose returns whether verbose output is enabled. Must be called after Init.

Types

This section is empty.

Jump to

Keyboard shortcuts

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