Skip to content

Commit

Permalink
Merge branch 'master' into a1346054-master
Browse files Browse the repository at this point in the history
  • Loading branch information
inkarkat committed Dec 27, 2024
2 parents cc73bd4 + 4129dad commit 564ed33
Show file tree
Hide file tree
Showing 64 changed files with 742 additions and 458 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- [ ] Fork [the repository](https://github.com/todotxt/todo.txt-cli) and create your branch from `master`.
- [ ] If you've added code that should be tested, add tests!
- [ ] Ensure the test suite passes.
- [ ] Format your code with [ShellCheck](https://www.shellcheck.net/).
- [ ] Lint your code with [ShellCheck](https://www.shellcheck.net/).
- [ ] 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.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab

jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, ubuntu-18.04]
platform: [ubuntu-24.04, macos-14]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: make
- run: make dist
- run: make test
Expand Down
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added
- `TODOTXT_DEFAULT_ACTION` now also allows action parameters ([#159], [#407])

## [2.13.0] - 2024-12-25

### Added
- listpri action allows concatenation of multiple priorities [-ranges]
- replace action completely merges any combination of priority / date with existing ([#386])
- Check for broken symlinks to custom actions and complain ([#359])

### Changed

- Add .sh extension to completion script
- Reuse the todo.sh alias for completion
- Return from user prompt without requiring Enter ([#354])
- Default to user writable directory in config ([#148])

### Fixed
- Fix problem with spaces in directory path ([#276])
- pri action takes multiple items + priorities on single run ([#346])

## [2.12.0] - 2020-08-11

### Added
Expand Down Expand Up @@ -461,7 +482,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Consolidated into one master script with usage notes and released.

[Unreleased]: https://github.com/todotxt/todo.txt-cli/compare/v2.12.0...HEAD
[Unreleased]: https://github.com/todotxt/todo.txt-cli/compare/v2.13.0...HEAD
[2.13.0]: https://github.com/todotxt/todo.txt-cli/compare/v2.12.0...v2.13.0
[2.12.0]: https://github.com/todotxt/todo.txt-cli/compare/v2.11.0...v2.12.0
[2.11.0]: https://github.com/todotxt/todo.txt-cli/compare/v2.10.0...v2.11.0
[2.10.0]: https://github.com/todotxt/todo.txt-cli/compare/v2.9.0...v2.10.0
Expand Down Expand Up @@ -492,7 +514,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[1.2.0]: https://github.com/todotxt/todo.txt-cli/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/todotxt/todo.txt-cli/compare/v1.0.0...v1.1.0
[#8]: https://github.com/todotxt/todo.txt-cli/pull/8
[#148]: https://github.com/todotxt/todo.txt-cli/pull/148
[#156]: https://github.com/todotxt/todo.txt-cli/pull/156
[#159]: https://github.com/todotxt/todo.txt-cli/pull/159
[#160]: https://github.com/todotxt/todo.txt-cli/pull/160
[#169]: https://github.com/todotxt/todo.txt-cli/pull/169
[#217]: https://github.com/todotxt/todo.txt-cli/pull/217
Expand All @@ -501,11 +525,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[#228]: https://github.com/todotxt/todo.txt-cli/pull/228
[#230]: https://github.com/todotxt/todo.txt-cli/pull/230
[#246]: https://github.com/todotxt/todo.txt-cli/pull/246
[#246]: https://github.com/todotxt/todo.txt-cli/pull/246
[#249]: https://github.com/todotxt/todo.txt-cli/pull/249
[#254]: https://github.com/todotxt/todo.txt-cli/pull/254
[#264]: https://github.com/todotxt/todo.txt-cli/pull/264
[#270]: https://github.com/todotxt/todo.txt-cli/pull/270
[#271]: https://github.com/todotxt/todo.txt-cli/pull/271
[#276]: https://github.com/todotxt/todo.txt-cli/pull/276
[#289]: https://github.com/todotxt/todo.txt-cli/pull/289
[#295]: https://github.com/todotxt/todo.txt-cli/pull/295
[#300]: https://github.com/todotxt/todo.txt-cli/pull/300
[#301]: https://github.com/todotxt/todo.txt-cli/pull/301
[#346]: https://github.com/todotxt/todo.txt-cli/pull/346
[#354]: https://github.com/todotxt/todo.txt-cli/pull/354
[#359]: https://github.com/todotxt/todo.txt-cli/pull/359
[#386]: https://github.com/todotxt/todo.txt-cli/pull/386
[#407]: https://github.com/todotxt/todo.txt-cli/pull/407
18 changes: 4 additions & 14 deletions GEN-VERSION-FILE
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
#!/bin/sh
#!/usr/bin/env bash
# Based on git's GIT-VERSION-GEN.

VF=VERSION-FILE
DEF_VER=v2.2

LF='
'
DEF_VER=v0.0

if test -d .git -o -f .git &&
VN=$(git describe --abbrev=0 --tags 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
git update-index -q --refresh
test -z "$(git diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
VN=$(git describe --dirty --tags 2>/dev/null)
then
VN=$(echo "$VN" | sed -e 's/-/./g');
VN=${VN//-/.}
else
VN="$DEF_VER"
fi
Expand Down
75 changes: 56 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,49 +33,84 @@ else
datarootdir = $(prefix)/share/bash_completion.d
endif

# generate list of targets from this Makefile
# looks for any lowercase target with a double hash mark (##) on the same line
# and uses the inline comment as the target description
.PHONY: help
.DEFAULT: help
help: ## list public targets
@echo
@echo todo.txt Makefile
@echo
@sed -ne '/^[a-z%-]\+:.*##/ s/:.*##/\t/p' $(word 1, $(MAKEFILE_LIST)) \
| column -t -s ' '
@echo

# Dynamically detect/generate version file as necessary
# This file will define a variable called VERSION.
.PHONY: .FORCE-VERSION-FILE
VERSION-FILE: .FORCE-VERSION-FILE
# This file will define a variable called VERSION used in
# both todo.sh and this Makefile.
VERSION-FILE:
@./GEN-VERSION-FILE
-include VERSION-FILE

# Maybe this will include the version in it.
todo.sh: VERSION-FILE
# dist/build directory name
DISTNAME=todo.txt_cli-$(VERSION)

# For packaging
DISTFILES := todo.cfg todo_completion
# files to copy unmodified into the dist directory
SRC_FILES := todo.cfg todo_completion

DISTNAME=todo.txt_cli-$(VERSION)
dist: $(DISTFILES) todo.sh
# path of SRC_FILES in the dist directory
OUTPUT_FILES := $(patsubst %, $(DISTNAME)/%, $(SRC_FILES))

# all dist files
DISTFILES := $(OUTPUT_FILES) $(DISTNAME)/todo.sh

# create the dist directory
$(DISTNAME): VERSION-FILE
mkdir -p $(DISTNAME)
cp -f $(DISTFILES) $(DISTNAME)/

# copy SRC_FILES to the dist directory
$(OUTPUT_FILES): $(DISTNAME)/%: %
cp -f $(*) $(DISTNAME)/

# generate todo.sh
$(DISTNAME)/todo.sh: VERSION-FILE
sed -e 's/@DEV_VERSION@/'$(VERSION)'/' todo.sh > $(DISTNAME)/todo.sh
chmod +x $(DISTNAME)/todo.sh

.PHONY: build
build: $(DISTNAME) $(DISTFILES) ## create the dist directory and files

.PHONY: dist
dist: build ## create the compressed release files
tar cf $(DISTNAME).tar $(DISTNAME)
gzip -f -9 $(DISTNAME).tar
zip -r -9 $(DISTNAME).zip $(DISTNAME)
rm -r $(DISTNAME)

.PHONY: clean
clean: test-pre-clean
clean: test-pre-clean VERSION-FILE ## remove dist directory and all release files
rm -rf $(DISTNAME)
rm -f $(DISTNAME).tar.gz $(DISTNAME).zip
rm VERSION-FILE

install: installdirs
$(INSTALL_PROGRAM) todo.sh $(DESTDIR)$(bindir)/todo.sh
$(INSTALL_DATA) todo_completion $(DESTDIR)$(datarootdir)/todo
.PHONY: install
install: build installdirs ## local package install
$(INSTALL_PROGRAM) $(DISTNAME)/todo.sh $(DESTDIR)$(bindir)/todo.sh
$(INSTALL_DATA) $(DISTNAME)/todo_completion $(DESTDIR)$(datarootdir)/todo.sh
[ -e $(DESTDIR)$(sysconfdir)/todo/config ] || \
sed "s/^\(export[ \t]*TODO_DIR=\).*/\1~\/.todo/" todo.cfg > $(DESTDIR)$(sysconfdir)/todo/config
sed "s/^\(export[ \t]*TODO_DIR=\).*/\1~\/.todo/" $(DISTNAME)/todo.cfg > $(DESTDIR)$(sysconfdir)/todo/config

uninstall:
.PHONY: uninstall
uninstall: ## uninstall package
rm -f $(DESTDIR)$(bindir)/todo.sh
rm -f $(DESTDIR)$(datarootdir)/todo
rm -f $(DESTDIR)$(sysconfdir)/todo/config

rmdir $(DESTDIR)$(datarootdir)
rmdir $(DESTDIR)$(sysconfdir)/todo

# create local installation directories
.PHONY: installdirs
installdirs:
mkdir -p $(DESTDIR)$(bindir) \
$(DESTDIR)$(sysconfdir)/todo \
Expand All @@ -87,18 +122,20 @@ installdirs:
TESTS = $(wildcard tests/t[0-9][0-9][0-9][0-9]-*.sh)
#TEST_OPTIONS=--verbose

# remove test detritus
test-pre-clean:
rm -rf tests/test-results "tests/trash directory"*

# run tests and generate test result files
aggregate-results: $(TESTS)

$(TESTS): test-pre-clean
cd tests && ./$(notdir $@) $(TEST_OPTIONS)

test: aggregate-results
# run tests, print a test result summary, and remove generated test results
test: aggregate-results ## run tests
tests/aggregate-results.sh tests/test-results/t*-*
rm -rf tests/test-results

# Force tests to get run every time
.PHONY: test test-pre-clean aggregate-results $(TESTS)

22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Download the latest stable [release][release] for use on your desktop or server.

```shell
brew install todo-txt
cp -n /usr/local/opt/todo-txt/todo.cfg ~/.todo.cfg

cp -n $(brew --prefix)/opt/todo-txt/todo.cfg ~/.todo.cfg
```

**Note**: The `-n` flag for `cp` makes sure you do not overwrite an existing file.
Expand All @@ -41,7 +42,7 @@ make test
*NOTE:* Makefile defaults to several default paths for installed files. Adjust to your system:

- `INSTALL_DIR`: PATH for executables (default /usr/local/bin)
- `CONFIG_DIR`: PATH for todo.txt config
- `CONFIG_DIR`: PATH for the todo.txt configuration template
- `BASH_COMPLETION`: PATH for autocompletion scripts (default to /etc/bash_completion.d)

```shell
Expand All @@ -53,6 +54,11 @@ make install CONFIG_DIR=/etc INSTALL_DIR=/usr/bin BASH_COMPLETION=/usr/share/bas
https://aur.archlinux.org/packages/todotxt/


## Configuration

No configuration is required; however, most users tweak the default settings (e.g. relocating the todo.txt directory to a subdirectory of the user's home directory, or onto a cloud drive (via the `TODO_DIR` variable)), modify the colors, add additional highlighting of projects, contexts, dates, and so on. A configuration template with a commented-out list of all available options is included.
It is recommended to _copy_ that template into one of the locations listed by `todo.sh help` on `-d CONFIG_FILE`, even if it is installed in the global configuration location (`/etc/todo/config`).

## Usage
```shell
todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description]
Expand All @@ -63,6 +69,18 @@ For example, to add a todo item, you can do:
```shell
todo.sh add "THING I NEED TO DO +project @context"
```
### `replace`
Replaces task on line NR with UPDATED TODO.

```shell
todo.sh replace NR "UPDATED TODO"
```
### `report`
Adds the number of open tasks and done tasks to report.txt.

```shell
todo.sh report
```

Read about all the possible commands in the [USAGE][USAGE] file.

Expand Down
Loading

0 comments on commit 564ed33

Please sign in to comment.