Skip to content

Commit 6598e46

Browse files
committed
ENH: Allow opt-in to sed emulation for add-ons via TODOTXT_SED_EXPORT_FOR_ADDONS flag
Most add-ons likely copied the "sed -i.bak ..." from todo.sh, but we can't be sure. Therefore, just document the issue in the configuration and offer a simple switch to enable it. As most users are either on Linux or Windows/Cygwin where this isn't an issue, the rather technical language only applies to users of BSD or MacOS users who don't want to install GNU sed.
1 parent 5bc7e65 commit 6598e46

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

todo.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,8 @@ export REPORT_FILE="$TODO_DIR/report.txt"
106106
# If you have GNU sed or another sed that supports in-place editing
107107
# via -i[SUFFIX], uncomment this for a minuscule performance gain.
108108
# export TODOTXT_SED_COMMAND=sed
109+
110+
# Uncomment this if you have add-ons that also do in-place editing
111+
# via sed, pass the -i.bak as the first argument like todo.sh itself,
112+
# and your system needs the in-place emulation.
113+
# export TODOTXT_SED_EXPORT_FOR_ADDONS=1

todo.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ sed() {
4242
command sed "$@"
4343
fi
4444
}
45+
[ "$TODOTXT_SED_EXPORT_FOR_ADDONS" = 1 ] \
46+
&& export -f sed
4547

4648
usage()
4749
{

0 commit comments

Comments
 (0)