Documentation
¶
Index ¶
Constants ¶
const ( ConfigPathDefault = ".schemadoc.yaml" ConfigPathEnv = "SCHEMADOC_CONFIG" )
Variables ¶
This section is empty.
Functions ¶
func ConfigPath ¶
ConfigPath resolves and returns the config path. Lookup order:
- Flag
- Environment variable
- Default path name
Types ¶
type App ¶
type App struct { Config *Config Logger *Logger Meta *Meta IO *ui.IOStreams UI *ui.UserInterface // contains filtered or unexported fields }
App contains global and/or singleton application data.
func AppForContext ¶
AppForContext returns the app singleton stored in the given context.
func NewApp ¶
NewApp returns the default App singleton. It will be minimally initialized with metadata and config. Call `Init()` after flag parsing to complete initialization.
func NewTestApp ¶
func NewTestApp() *App
NewTestApp returns the test App singleton. All properties will be configured for testing (mocks, stubs, etc).
func (*App) Context ¶
Context returns the root context.Context for the app.
func (*App) Init ¶
Init initializes and configures the app. It must be called once flags have been parsed.
func (*App) InitForTest ¶
func (a *App) InitForTest()
Init initializes and configures the app for unit testing.
type Config ¶
type Config struct { ConfigPath string Color bool `yaml:"color" env:"SCHEMADOC_COLOR" default:"true"` Debug bool `yaml:"debug" env:"SCHEMADOC_DEBUG"` Prompt bool `yaml:"prompt" env:"SCHEMADOC_PROMPT" default:"true"` LogLevel string `yaml:"log_level" env:"SCHEMADOC_LOG_LEVEL" default:"warn" validate:"oneof=debug info warn error fatal"` //nolint: lll }
func NewConfigFromPath ¶
NewConfigFromPath returns a new config for the file at path.
func NewTestConfig ¶
NewTestConfig returns a new Config for unit tests populated with default values.
type Logger ¶
Logger is a simple wrapper around the charmbracelet/log package.