Skip to content

feat: add XDG, env var, and CLI support for config/data paths - #523

Merged
boxdot merged 5 commits into
boxdot:mainfrom
MarkAtwood:xdg-config-support
Jul 11, 2026
Merged

feat: add XDG, env var, and CLI support for config/data paths#523
boxdot merged 5 commits into
boxdot:mainfrom
MarkAtwood:xdg-config-support

Conversation

@MarkAtwood

Copy link
Copy Markdown
Contributor

Summary

  • Add --config and --data-dir CLI options
  • Add GURK_CONFIG and GURK_DATA_DIR environment variables
  • Honor XDG_CONFIG_HOME and XDG_DATA_HOME on all platforms (including macOS)
  • Update README with new configuration options

Motivation

The dirs crate ignores XDG environment variables on macOS, using ~/Library/Application Support instead. This is frustrating for users who prefer XDG-style directory organization on macOS.

This PR adds multiple ways to override paths:

Method Config Data dir
CLI arg -c, --config <PATH> --data-dir <PATH>
Env var GURK_CONFIG GURK_DATA_DIR
XDG env XDG_CONFIG_HOME XDG_DATA_HOME

Priority (highest to lowest):

  1. CLI arg / env var
  2. XDG env vars
  3. Config file setting
  4. Platform default

Test plan

  • cargo test passes
  • cargo check passes
  • gurk --help shows new options with env var hints
  • Manual testing with GURK_CONFIG and GURK_DATA_DIR
  • Manual testing with XDG_CONFIG_HOME and XDG_DATA_HOME on macOS

- Add --config and --data-dir CLI options
- Add GURK_CONFIG and GURK_DATA_DIR environment variables
- Honor XDG_CONFIG_HOME and XDG_DATA_HOME on all platforms
- Clear hardcoded sqlite paths when --data-dir is specified
- Update README with new configuration options
@MarkAtwood
MarkAtwood force-pushed the xdg-config-support branch from dba4a8f to 833a01a Compare April 6, 2026 01:57
@boxdot

boxdot commented Apr 26, 2026

Copy link
Copy Markdown
Owner

@MarkAtwood Eventhough there are still open todo, I think we can ship it as is. WDYT?

@MarkAtwood

Copy link
Copy Markdown
Contributor Author

Agreed — ship it as is. I'll follow up on the remaining TODOs in a separate PR.

@boxdot
boxdot enabled auto-merge (squash) July 11, 2026 16:45
@boxdot
boxdot merged commit 7ba7f70 into boxdot:main Jul 11, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants