Skip to content

Commit

Permalink
Fix for #4
Browse files Browse the repository at this point in the history
  • Loading branch information
rhydlewis committed Apr 19, 2022
1 parent 65873f6 commit 95cfafb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const TAG = 'c'
const INBOX = 'i'
const NOTE = 'n'

const SINGLE_QUOTE = "'"
const ESC_SINGLE_QUOTE = "''"

function main() {
if (alfy.config.get('dbPath') === undefined) {
alfy.output(createError("'dbPath' is missing", "Use get-of-db and set-of-db keywords"))
Expand All @@ -35,28 +38,33 @@ function main() {

function runWorkflow() {
let results = undefined
let query = argv.query
if (query.includes(SINGLE_QUOTE)) {
query = query.replaceAll(SINGLE_QUOTE, ESC_SINGLE_QUOTE)
}

try {
switch (argv.type) {
case PERSPECTIVE:
perspectiveQuery(argv.query);
perspectiveQuery(query);
break;
case TASK:
results = searchTasks(argv.query, argv.completedOnly, argv.flaggedOnly, argv.activeOnly, argv.everything);
results = searchTasks(query, argv.completedOnly, argv.flaggedOnly, argv.activeOnly, argv.everything);
break;
case PROJECT:
results = searchProjects(argv.query, argv.activeOnly);
results = searchProjects(query, argv.activeOnly);
break;
case FOLDER:
results = searchFolders(argv.query);
results = searchFolders(query);
break;
case TAG:
results = searchTags(argv.query);
results = searchTags(query);
break;
case INBOX:
results = searchInbox(argv.query);
results = searchInbox(query);
break;
case NOTE:
results = searchNotes(argv.query, argv.activeOnly, argv.flaggedOnly);
results = searchNotes(query, argv.activeOnly, argv.flaggedOnly);
break;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alfred-search-omnifocus",
"version": "1.0.4",
"version": "1.0.5",
"licence": "MIT",
"description": "This is a workflow for Alfred that performs free text searches on OmniFocus data",
"engines": {
Expand Down

0 comments on commit 95cfafb

Please sign in to comment.