feat: move config to XDG path with legacy migration warning#14
Merged
Conversation
termdown now reads ~/.config/termdown/config.toml (or $XDG_CONFIG_HOME/termdown/config.toml) instead of ~/.termdown/config.toml. When a legacy ~/.termdown/config.toml is found while the new path is empty, it warns rather than dropping the old settings silently. - config_dir() honors an absolute $XDG_CONFIG_HOME, else ~/.config - uninstall.sh removes both new and legacy dirs, mirroring the loader's absolute-XDG rule - add config.example.toml documenting every default - tests for XDG loading, the migration warning, and example-file drift - sweep docs/README/CHANGELOG/ADR to the new path Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Windows CI run failed because `Path::display` emits `\` separators,
so `contains(".termdown/config.toml")` never matched. Assert on the
distinctive `.termdown` legacy dir name instead, which holds on all platforms.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Migrates termdown's config directory from
~/.termdown/to the XDG path~/.config/termdown/(honoring$XDG_CONFIG_HOME), and avoids silently dropping existing user settings during the upgrade.Changes
config_dir()now prefers an absolute$XDG_CONFIG_HOME, otherwise falls back to~/.config/termdown(USERPROFILEcovers Windows). Relative/emptyXDG_CONFIG_HOMEis ignored per the XDG spec.load()finds no config at the new path but a~/.termdown/config.tomlstill exists, it prints a one-line stderr warning instead of failing silently.uninstall.shremoves both the new and legacy config dirs, and mirrors the loader's "absolute$XDG_CONFIG_HOMEonly" rule so it deletes what the binary actually reads.config.example.toml(new) documents every default, copy-pasteable.--help/ CHANGELOG all point at the new path.Tests
xdg_config_home_is_honored_for_config_loading— proves aconfig.tomlunder$XDG_CONFIG_HOME/termdown/actually loads.legacy_config_location_triggers_migration_warning— asserts the migration warning fires.example_config_parses_and_matches_defaults— guardsconfig.example.tomlagainst drift viainclude_str!.XDG_CONFIG_HOMEso a developer's real config can't leak into tests.make checkpasses clean (fmt-check + clippy-D warnings+ tests).Breaking change
Existing users must move
~/.termdown/config.toml→~/.config/termdown/config.toml. The new warning nudges them; pre-1.0 so acceptable.🤖 Generated with Claude Code