Skip to content

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

Merged
inkarkat merged 1 commit into
todotxt:masterfrom
inkarkat:overridable-config
Jun 26, 2026
Merged

ENH: Config should allow external override of file locations#460
inkarkat merged 1 commit into
todotxt:masterfrom
inkarkat:overridable-config

Conversation

@inkarkat

@inkarkat inkarkat commented May 15, 2025

Copy link
Copy Markdown
Member

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.

@inkarkat inkarkat force-pushed the overridable-config branch from 22f691d to 4b273b4 Compare May 15, 2025 13:43
Comment thread tests/t1050-todofile-override.sh Outdated
@inkarkat inkarkat requested a review from karbassi October 2, 2025 06:16
@karbassi karbassi requested a review from Copilot October 3, 2025 19:11

Copilot AI left a comment

Copy link
Copy Markdown

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 thread todo.cfg
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
Copy Markdown
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.

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 95b6d46 to 1531ab0 Compare June 26, 2026 10:41
@inkarkat inkarkat merged commit 20497a8 into todotxt:master Jun 26, 2026
2 checks passed
@inkarkat inkarkat deleted the overridable-config branch June 26, 2026 10:42
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