fix: gracefully handle missing config file (closes #2)#33
Open
DrGalio wants to merge 1 commit intoApexOpsStudio:mainfrom
Open
fix: gracefully handle missing config file (closes #2)#33DrGalio wants to merge 1 commit intoApexOpsStudio:mainfrom
DrGalio wants to merge 1 commit intoApexOpsStudio:mainfrom
Conversation
- load_config() now creates a default config when ~/.config/task-cli/config.yaml is missing - Default config includes sensible defaults matching config.yaml.example - Config directory is created automatically with parents - Added tests for both missing-config and existing-config scenarios - Updated README to document automatic default config creation All existing tests continue to pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the crash when
~/.config/task-cli/config.yamlis missing by havingload_config()create a sensible default config automatically.Changes
task.py:load_config()now checks if the config file exists. If missing, it creates the config directory and writes a default config file matchingconfig.yaml.exampledefaults.test_task.py: Added two new tests:test_load_config_creates_default_when_missing— verifies no crash and default file creationtest_load_config_reads_existing_file— verifies existing configs are still read correctly.gitignore: Added__pycache__/to keep the repo cleanREADME.md: Updated configuration docs to mention automatic default config creationTesting
All tests pass:
Acceptance Criteria
Closes #2