Skip to content

ENH: Config should allow external override of file locations#460

Open
inkarkat wants to merge 2 commits intotodotxt:masterfrom
inkarkat:overridable-config
Open

ENH: Config should allow external override of file locations#460
inkarkat wants to merge 2 commits intotodotxt:masterfrom
inkarkat:overridable-config

Conversation

@inkarkat
Copy link
Member

@inkarkat inkarkat commented May 15, 2025

E.g. on the command-line:

$ TODO_FILE=/path/to/other.txt todo.sh lsc

Or through aliases that customize todo.sh for particular todo files:

alias todoinbox='TODO_FILE=/path/to/inbox.txt todo.sh'

Only non-empty values will override the config default.

Cp. #459

Before submitting a pull request, please make sure the following is done:

  • Fork the repository and create your branch from master.
  • If you've added code that should be tested, add tests!
  • Ensure the test suite passes.
  • Lint your code with ShellCheck.
  • Include a human-readable description of what the pull request is trying to accomplish.
  • Steps for the reviewer(s) on how they can manually QA the changes.
  • Have a fixes #XX reference to the issue that this pull request fixes.

E.g. on the command-line:
$ TODO_FILE=/path/to/other.txt todo.sh lsc
Or through aliases that customize todo.sh for particular todo files:
alias todoinbox='TODO_FILE=/path/to/inbox.txt todo.sh'

Only non-empty values will override the config default.

Cp. todotxt#459
@inkarkat inkarkat force-pushed the overridable-config branch from 22f691d to 4b273b4 Compare May 15, 2025 13:43
@inkarkat inkarkat requested a review from karbassi October 2, 2025 06:16
@karbassi karbassi requested a review from Copilot October 3, 2025 19:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables external override of file locations in the todo.txt-cli configuration through environment variables, allowing users to customize TODO_FILE, DONE_FILE, and REPORT_FILE locations via command-line or aliases.

  • Modifies the configuration mechanism to use parameter expansion with default values instead of direct assignment
  • Updates export statements to allow environment variable overrides while maintaining backward compatibility
  • Adds comprehensive test coverage for the new override functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
todo.cfg Updates configuration to use parameter expansion for overrideable file locations
tests/t1050-todofile-override.sh New test file covering TODO_FILE and DONE_FILE override scenarios
tests/t1950-report.sh Adds test case for REPORT_FILE override functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +9 to +12
: ${TODO_FILE:="${TODO_DIR}/todo.txt"}
: ${DONE_FILE:="${TODO_DIR}/done.txt"}
: ${REPORT_FILE:="${TODO_DIR}/report.txt"}
export TODO_FILE DONE_FILE REPORT_FILE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never seen this pattern before. Cool.

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.

4 participants