Skip to content

Merge for #36 #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/ez.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
tags:
- '*-ez'

name: Create Easy Release

jobs:
build:
name: Create Easy Release
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Build
run: |
./dist
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Easy Things 3 CSV Export
body: |
- Click the Things3Export.zip link below to download
- Unzip the downloaded Things3Export.zip by double clicking (if your browser didn't unzip it automatically)
- Double click Export in the new Things3Export directory
- You may have to  → System Preferences... → Security & Privacy → General → Open Anyway

This will create Things3Export.csv in the same directory.

Downloads ↓
draft: false
prerelease: false
- name: Upload Release Asset
id: upload_release_zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Things3Export.zip
asset_name: Things3Export.zip
asset_content_type: application/zip
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ coverage
*.csv
.DS_Store

/Things3Export
/Things3Export.zip
18 changes: 18 additions & 0 deletions Export
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Copyright 2019 Amazing Marvin
# License: public domain

# Jump to dir of this source file (in case user double clicks Export)
cd -- "$(dirname "$BASH_SOURCE")"

# In releases, all things.sh content goes in a scripts/ dir so it's obvious
# what to double-click.
if [ -d scripts ]; then
cd scripts
fi

# Export with "," separator instead of ";". It would be nice to use UTF-8 but
# this didn't work on one system I tried it on so it seems to be safer without.
SEP="," ENCODING="UTF-8" ./things.sh csv > Things3Export.csv

mv Things3Export.csv ..
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,9 @@ It has [some benefits](https://blog.amazingmarvin.com/5-benefits-of-using-time-e
- Shell tips : [https://google.github.io/styleguide/shell.xml](https://google.github.io/styleguide/shell.xml)
- Shell tips : [https://kvz.io/blog/2013/11/21/bash-best-practices/](https://kvz.io/blog/2013/11/21/bash-best-practices/)
- Shell tips : [https://github.com/progrium/bashstyle](https://github.com/progrium/bashstyle)

## EZ Releases

* Rebase on upstream/master
* Run `./dist` to make new Things3Export.zip
* Add Release on github, tag x.y-ez
6 changes: 6 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
How to release? Just push a new tag that ends with "ez" and let github actions build the zip and create the release.

```bash
git tag -a v2.10-ez -m 'v2.10-ez'
git push --tags
```
13 changes: 13 additions & 0 deletions dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

rm -rf Things3Export Things3Export.zip
mkdir Things3Export
cp Export Things3Export
cat <<EOF > Things3Export/README.txt
Double click Export to create Things3Export.csv
See https://github.com/AlexanderWillner/things.sh for more info
EOF
mkdir Things3Export/scripts
cp -r things.sh README.md plugins Things3Export/scripts

zip -9 Things3Export.zip -r Things3Export
2 changes: 1 addition & 1 deletion plugins/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TASK.title
FROM $TASKTABLE TASK
LEFT OUTER JOIN $TASKTABLE PROJECT ON TASK.project = PROJECT.uuid
LEFT OUTER JOIN $AREATABLE AREA ON TASK.area = AREA.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.actionGroup = HEADING.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.heading = HEADING.uuid
WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN AND TASK.$ISTASK
ORDER BY TASK.$ORDER_BY
LIMIT $LIMIT_BY
Expand Down
6 changes: 3 additions & 3 deletions plugins/csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ SELECT
'things:///show?id='||T1.uuid,
date(T1.creationDate,"unixepoch"),
date(T1.userModificationDate,"unixepoch"),
date(T1.dueDate,"unixepoch"),
date(T1.deadline,"unixepoch"),
date(T1.startDate,"unixepoch"),
date(T1.stopDate,"unixepoch"),
CASE WHEN T1.recurrenceRule IS NULL THEN 'False' ELSE 'True' END,
CASE WHEN T1.rt1_recurrenceRule IS NULL THEN 'False' ELSE 'True' END,
HEADING.title,
PROJECT.title,
AREA.title,
Expand All @@ -35,7 +35,7 @@ SELECT
FROM $TASKTABLE T1
LEFT OUTER JOIN $TASKTABLE PROJECT ON T1.project = PROJECT.uuid
LEFT OUTER JOIN $AREATABLE AREA ON T1.area = AREA.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON T1.actionGroup = HEADING.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON T1.heading = HEADING.uuid
LEFT OUTER JOIN $TASKTAGTABLE TAGS ON T1.uuid = TAGS.tasks
LEFT OUTER JOIN $TAGTABLE TAG ON TAGS.tags = TAG.uuid
WHERE T1.$ISNOTTRASHED AND (T1.$ISOPEN OR T1.$ISCOMPLETED)
Expand Down
8 changes: 4 additions & 4 deletions plugins/due.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ queryDue() {
getDueQuery() {
read -rd '' query <<-SQL || true
SELECT
date(TASK.dueDate,"unixepoch"),
date(TASK.deadline,"unixepoch"),
CASE
WHEN AREA.title IS NOT NULL THEN AREA.title
WHEN PROJECT.title IS NOT NULL THEN PROJECT.title
Expand All @@ -27,10 +27,10 @@ SELECT
FROM $TASKTABLE as TASK
LEFT OUTER JOIN $TASKTABLE PROJECT ON TASK.project = PROJECT.uuid
LEFT OUTER JOIN $AREATABLE AREA ON TASK.area = AREA.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.actionGroup = HEADING.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.heading = HEADING.uuid
WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN
AND TASK.dueDate NOT NULL
ORDER BY TASK.dueDate
AND TASK.deadline NOT NULL
ORDER BY TASK.deadline
LIMIT $LIMIT_BY
SQL
echo "$query"
Expand Down
2 changes: 1 addition & 1 deletion plugins/headings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SELECT
FROM $TASKTABLE TASK
LEFT OUTER JOIN $TASKTABLE PROJECT ON TASK.project = PROJECT.uuid
LEFT OUTER JOIN $AREATABLE AREA ON TASK.area = AREA.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.actionGroup = HEADING.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.heading = HEADING.uuid
WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN AND TASK.$ISHEADING
ORDER BY TASK.$ORDER_BY
LIMIT $LIMIT_BY
Expand Down
2 changes: 1 addition & 1 deletion plugins/nextish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SELECT
FROM $TASKTABLE TASK
LEFT OUTER JOIN $TASKTABLE PROJECT ON TASK.project = PROJECT.uuid
LEFT OUTER JOIN $AREATABLE AREA ON TASK.area = AREA.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.actionGroup = HEADING.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.heading = HEADING.uuid
WHERE TASK.$ISNOTTRASHED AND TASK.$ISSTARTED AND TASK.$ISOPEN AND TASK.$ISTASK
ORDER BY TASK.$ORDER_BY
LIMIT $LIMIT_BY
Expand Down
2 changes: 1 addition & 1 deletion plugins/old.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SELECT
FROM $TASKTABLE as TASK
LEFT OUTER JOIN $TASKTABLE PROJECT ON TASK.project = PROJECT.uuid
LEFT OUTER JOIN $AREATABLE AREA ON TASK.area = AREA.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.actionGroup = HEADING.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.heading = HEADING.uuid
WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN AND TASK.$ISTASK AND TASK.recurrenceRule IS NULL
ORDER BY TASK.$ORDER_BY
LIMIT $LIMIT_BY
Expand Down
2 changes: 1 addition & 1 deletion plugins/projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SELECT
FROM $TASKTABLE as TASK
LEFT OUTER JOIN $TASKTABLE PROJECT ON TASK.project = PROJECT.uuid
LEFT OUTER JOIN $AREATABLE AREA ON TASK.area = AREA.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.actionGroup = HEADING.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.heading = HEADING.uuid
WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN AND TASK.$ISPROJECT
ORDER BY TASK.$ORDER_BY
LIMIT $LIMIT_BY
Expand Down
2 changes: 1 addition & 1 deletion plugins/search.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SELECT
T1.title as "Title",
date(T1.creationDate,"unixepoch") as "Created",
date(T1.userModificationDate,"unixepoch") as "Modified",
date(T1.dueDate,"unixepoch") as "Due",
date(T1.deadline,"unixepoch") as "Due",
date(T1.startDate,"unixepoch") as "Start",
date(T1.stopDate,"unixepoch") as "Stopped",
T2.title as "Project",
Expand Down
2 changes: 1 addition & 1 deletion plugins/waiting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ FROM TMTaskTag TAGS
LEFT JOIN $TASKTABLE TASK ON TAGS.tasks = TASK.uuid
LEFT OUTER JOIN $TASKTABLE PROJECT ON TASK.project = PROJECT.uuid
LEFT OUTER JOIN $AREATABLE AREA ON TASK.area = AREA.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.actionGroup = HEADING.uuid
LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.heading = HEADING.uuid
WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN
AND TAGS.tags=(SELECT uuid FROM $TAGTABLE WHERE title='$WAITING_TAG')
ORDER BY TASK.$ORDER_BY
Expand Down
8 changes: 7 additions & 1 deletion things.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ realpath() {
}
readonly PROGNAME="$(basename "$0")"
readonly PATHNAME="$(dirname "$(realpath "$0")")"
readonly DEFAULT_DB="$HOME/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/Things Database.thingsdatabase/main.sqlite"

readonly DEFAULT_DB=$(find ~/Library/Group\ Containers/JLMPQHK86H.com.culturedcode.ThingsMac -name 'main.sqlite' | head -1)
if [[ -z "$DEFAULT_DB" ]]; then
echo "Your database wasn't found!"
exit 1
fi

readonly THINGSDB="${THINGSDB:-$DEFAULT_DB}"
readonly PLUGINDIR="$PATHNAME/plugins"
###############################################################################
Expand Down