Skip to content

Commit

Permalink
Changing adding slashes to URL and exporting not only tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWillner committed Jan 13, 2018
1 parent bd8db2c commit fe7a4e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Days/Task : 41.0

## Things URL Helper

The application ```ThingsURLHelper.app``` opens URLs of the form ```thingstodo:show?uuid=XXX``` with XXX being the ```UUID``` of a todo.
The application ```ThingsURLHelper.app``` opens URLs of the form ```thingstodo://show?uuid=XXX``` with XXX being the ```UUID``` of a todo.
By using ```things.sh csv``` you can identify the according URL of each task and open it via spotlight for example.

## CREDITS
Expand Down
13 changes: 8 additions & 5 deletions plugins/csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ myPluginMethod="exportCSV"
eval "$myPlugin=('$myPluginCommand' '$myPluginDescription' '$myPluginMethod')"

exportCSV() {
echo 'Title;"URI";"Creation Date";"Modification Date";"Due Date";"Start Date";"Completion Date";"Recurring";Project;Area;Subtask;Notes'
echo '"Title";"Type";"URI";"Creation Date";"Modification Date";"Due Date";"Start Date";"Completion Date";"Recurring";"Project";"Area";"Subtask";"Notes"'
sqlite3 -list -separator ';' "$THINGSDB" "$(getCSVQuery1)" | awk '{gsub("<[^>]*>", "")}1' | iconv -c -f UTF-8 -t WINDOWS-1252//TRANSLIT || true
sqlite3 -list -separator ';' "$THINGSDB" "$(getCSVQuery2)" | awk '{gsub("<[^>]*>", "")}1' | iconv -c -f UTF-8 -t WINDOWS-1252//TRANSLIT || true
}

getCSVQuery1() {
read -rd '' query <<-SQL || true
SELECT
T1.title,
'thingstodo:show?uuid='||T1.uuid,
T1.title,
T1.type,
'thingstodo://show?uuid='||T1.uuid,
date(T1.creationDate,"unixepoch"),
date(T1.userModificationDate,"unixepoch"),
date(T1.dueDate,"unixepoch"),
Expand All @@ -32,7 +33,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
WHERE T1.$ISNOTTRASHED AND (T1.$ISOPEN OR T1.$ISCOMPLETED) AND T1.$ISTASK;
WHERE T1.$ISNOTTRASHED AND (T1.$ISOPEN OR T1.$ISCOMPLETED);
SQL
echo "${query}"
}
Expand All @@ -41,7 +42,8 @@ getCSVQuery2() {
read -rd '' query <<-SQL || true
SELECT
T2.title,
'thingstodo:show?uuid='||T2.uuid,
T2.type,
'thingstodo://show?uuid='||T2.uuid,
date(T1.creationDate,"unixepoch"),
date(T1.userModificationDate,"unixepoch"),
"",
Expand All @@ -58,3 +60,4 @@ WHERE (T2.$ISOPEN OR T2.$ISCOMPLETED) AND T2.$ISNOTTRASHED;
SQL
echo "${query}"
}

0 comments on commit fe7a4e3

Please sign in to comment.