✨ Configurable default language via env var and ~/.askcc/config.toml#93
Merged
Conversation
…(refs #92) Resolve the default --language value from CLI > env (ASKCC_LANGUAGE) > ~/.askcc/config.toml [defaults].language > built-in default (english). Invalid values warn and fall through. Missing config files are silent. - Move SupportedLanguage enum from definitions.py to settings.py to break the import cycle with the new DEFAULT_LANGUAGE constant. - Add _load_user_config() and _resolve_default_language() in settings.py. - Wire DEFAULT_LANGUAGE into the argparse default in cli.py. - Document ASKCC_LANGUAGE and the user config file in README.md.
9 tasks
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.
Closes #92
Summary
--languagenow resolves from CLI > env (ASKCC_LANGUAGE) >~/.askcc/config.toml[defaults].language> built-in default (english). Invalid values warn and fall through; missing config files are silent._load_user_config()(caches parsed~/.askcc/config.tomlat module import) and_resolve_default_language()inaskcc/settings.py, mirroring the existing_resolve_effort_level()pattern.SupportedLanguagefromaskcc/definitions.pytoaskcc/settings.pyto avoid a circular import (same constraint that already pinnedVALID_EFFORT_LEVELShere). All known call sites updated.Files touched
askcc/settings.py—tomllibimport,SupportedLanguage(moved here),USER_CONFIG_PATH,_load_user_config,_USER_CONFIG,_resolve_default_language,DEFAULT_LANGUAGE.askcc/definitions.py— removeSupportedLanguage(now lives insettings.py).askcc/cli.py— splitSupportedLanguageimport to.settings; switch argparse default tosettings.DEFAULT_LANGUAGE; update help text.tests/test_askcc.py— updateSupportedLanguageimport path; addTestDefaultLanguageResolution(11 tests).README.md— documentASKCC_LANGUAGEand~/.askcc/config.tomlprecedence.Test plan
uv run pytest— 197 passed (11 new tests inTestDefaultLanguageResolution)uv run ruff check— cleanuv run pyright— 0 errorsRisks / notes
SupportedLanguageimport path change is internal-only (package markedPrivate :: Do Not Upload)._USER_CONFIGcache means refresh requires a fresh process; tests inject a dict via the optionaluser_configargument.