Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ff9386
commit d84294a
Showing
30 changed files
with
1,160 additions
and
760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.travis.yml export-ignore | ||
/.gitignore export-ignore | ||
/.gitattributes export-ignore | ||
/img export-ignore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
getNextPluginID() { | ||
idx=0 | ||
plugin="plugin$idx" | ||
while [[ ! -z "${!plugin:-}" ]]; do | ||
idx=$((idx + 1)) | ||
plugin="plugin$idx" | ||
done | ||
echo $idx | ||
} | ||
|
||
getPluginHelp() { | ||
idx=0 | ||
plugin="plugin$idx" | ||
while [[ ! -z "${!plugin:-}" ]]; do | ||
command="plugin$idx[0]" | ||
description="plugin$idx[1]" | ||
method="plugin$idx[2]" | ||
cmd=${!command} | ||
line=' ' | ||
printf " %s %s ${!description}\n" $cmd "${line:${#cmd}}" | ||
idx=$((idx + 1)) | ||
plugin="plugin$idx" | ||
done | ||
} | ||
|
||
getCommands() { | ||
idx=0 | ||
plugin="plugin$idx" | ||
while [[ ! -z "${!plugin:-}" ]]; do | ||
command="plugin$idx[0]" | ||
echo -n "${!command} " | ||
idx=$((idx + 1)) | ||
plugin="plugin$idx" | ||
done | ||
} | ||
|
||
invokePlugin() { | ||
idx=0 | ||
plugin="plugin$idx" | ||
while [[ ! -z "${!plugin:-}" ]]; do | ||
command="plugin$idx[0]" | ||
description="plugin$idx[1]" | ||
method="plugin$idx[2]" | ||
if [[ "${!command}" == "$1" ]]; then | ||
eval "${!method}" | ||
fi | ||
idx=$((idx + 1)) | ||
plugin="plugin$idx" | ||
done | ||
} | ||
|
||
hasPlugin() { | ||
idx=0 | ||
plugin="plugin$idx" | ||
while [[ ! -z "${!plugin:-}" ]]; do | ||
command="plugin$idx[0]" | ||
description="plugin$idx[1]" | ||
method="plugin$idx[2]" | ||
if [[ "${!command}" == "$1" ]]; then | ||
return 0 | ||
fi | ||
idx=$((idx + 1)) | ||
plugin="plugin$idx" | ||
done | ||
return 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
myPluginID=$(getNextPluginID) | ||
myPlugin="plugin$myPluginID" | ||
myPluginCommand='inbox' | ||
myPluginDescription="Shows $limitBy inbox tasks ordered by '$orderBy'" | ||
myPluginMethod='queryInbox' | ||
|
||
eval "$myPlugin=('$myPluginCommand' '$myPluginDescription' '$myPluginMethod')" | ||
|
||
queryInbox() { | ||
sqlite3 "$THINGSDB" "$(getInboxQuery)" | ||
} | ||
|
||
getInboxQuery() { | ||
read -rd '' query <<-SQL || true | ||
SELECT title | ||
FROM $TASKTABLE TASK | ||
WHERE $ISNOTTRASHED AND $ISTASK AND $ISNOTSTARTED AND $ISOPEN | ||
ORDER BY TASK.$orderBy | ||
LIMIT $limitBy | ||
SQL | ||
echo "${query}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
myPluginID=$(getNextPluginID) | ||
myPlugin="plugin$myPluginID" | ||
myPluginCommand='today' | ||
myPluginDescription="Shows $limitBy todays tasks ordered by index" | ||
myPluginMethod='queryToday' | ||
|
||
eval "$myPlugin=('$myPluginCommand' '$myPluginDescription' '$myPluginMethod')" | ||
|
||
queryToday() { | ||
sqlite3 "$THINGSDB" "$(getTodayQuery)" | ||
} | ||
|
||
getTodayQuery() { | ||
read -rd '' query <<-SQL || true | ||
SELECT | ||
CASE | ||
WHEN AREA.title IS NOT NULL THEN AREA.title | ||
WHEN PROJECT.title IS NOT NULL THEN PROJECT.title | ||
WHEN HEADING.title IS NOT NULL THEN HEADING.title | ||
ELSE "(No Context)" | ||
END, | ||
TASK.title | ||
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 | ||
WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN AND TASK.$ISTASK | ||
AND TASK.$ISSTARTED | ||
AND TASK.startdate is NOT NULL | ||
ORDER BY TASK.startdate, TASK.todayIndex | ||
LIMIT $limitBy | ||
SQL | ||
echo "${query}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
myPluginID=$(getNextPluginID) | ||
myPlugin="plugin$myPluginID" | ||
myPluginCommand='upcoming' | ||
myPluginDescription="Shows $limitBy upcoming tasks ordered by date" | ||
myPluginMethod='queryUpcoming' | ||
|
||
eval "$myPlugin=('$myPluginCommand' '$myPluginDescription' '$myPluginMethod')" | ||
|
||
queryUpcoming() { | ||
sqlite3 "$THINGSDB" "$(getUpcomingQuery)" | ||
} | ||
|
||
getUpcomingQuery() { | ||
read -rd '' query <<-SQL || true | ||
SELECT | ||
CASE | ||
WHEN TASK.startDate IS NULL THEN "0000-00-00" | ||
ELSE date(TASK.startDate,"unixepoch") | ||
END, | ||
CASE | ||
WHEN AREA.title IS NOT NULL THEN AREA.title | ||
WHEN PROJECT.title IS NOT NULL THEN PROJECT.title | ||
WHEN HEADING.title IS NOT NULL THEN HEADING.title | ||
ELSE "(No Context)" | ||
END, | ||
TASK.title | ||
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 | ||
WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN AND TASK.$ISTASK | ||
AND TASK.$ISPOSTPONED AND (TASK.startDate NOT NULL OR TASK.recurrenceRule NOT NULL) | ||
ORDER BY TASK.startdate, TASK.todayIndex | ||
LIMIT $limitBy | ||
SQL | ||
echo "${query}" | ||
} |
Oops, something went wrong.