You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add profile-based config support (#11) (#20)
Implement profile-based configuration system that allows users to maintain
multiple config variants (e.g., work, home, personal) and switch between
them using the --profile flag.
Features:
- LoadWithProfile() function to load and merge profile configs
- --profile global flag for all commands
- Profile configs stored in ~/.rune/profiles/{name}.yaml
- Safe merge behavior: profiles override base config where specified
- Projects are appended, templates are merged, other fields override
- Clear error messages for missing profiles
- Full validation of merged configs
Implementation:
- Added config.LoadWithProfile() with profile merging logic
- Added config.GetProfilePath() to locate profile files
- Added config.mergeConfigs() with safe merge behavior
- Added --profile flag to root command as persistent flag
- Created loadConfigWithProfile() helper in commands/root.go
- Updated all commands to use loadConfigWithProfile()
- Comprehensive test coverage for all profile operations
Tests:
- TestLoadWithProfile_MissingProfile: validates error handling
- TestLoadWithProfile_EmptyProfile: validates fallback to base config
- TestLoadWithProfile_ValidProfile: validates merge behavior
- TestMergeConfigs: validates merge logic in detail
- TestGetProfilePath: validates profile path resolution
All existing tests continue to pass.
Co-authored-by: John Ferguson <john.ferguson@jferguson.info>
0 commit comments