Quickstart Guide
This guide will help you get started with ConfigBuddy quickly.
Basic Usage
Load a configuration file:
from configbuddy import Config
# Load from YAML
config = Config.from_file('config.yaml')
# Or from JSON
config = Config.from_file('config.json')
Visualize configuration:
# Print configuration as a tree
config.visualize()
Compare configurations:
config1 = Config.from_file('config1.yaml')
config2 = Config.from_file('config2.yaml')
# Compare configurations
diff = config1.diff_with(config2)
# Visualize differences
diff.visualize()
Merge configurations:
# Merge with another configuration
merged, conflicts = config1.merge_with(config2)
if conflicts:
print("Merge conflicts:", conflicts)
else:
merged.save('merged.yaml')
Validate configuration:
from configbuddy import ConfigValidator
# Create validator with schema
validator = ConfigValidator.from_file('schema.json')
# Validate configuration
is_valid = validator.validate(config)
if not is_valid:
print("Validation errors:", validator.errors)
CLI Usage
ConfigBuddy also provides a powerful CLI interface. Here are some common commands:
Visualize a configuration:
configbuddy visualize config.yaml
Compare configurations:
configbuddy diff base.yaml --compare other.yaml
Merge configurations:
configbuddy merge base.yaml override.yaml -o merged.yaml
Validate configuration:
configbuddy validate config.yaml --schema schema.json
For more detailed information about the CLI, see the Command Line Interface section.