Skip to content

Commit

Permalink
Remove root script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaine Schmeisser committed Jan 11, 2017
1 parent af5948f commit 1980965
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
27 changes: 10 additions & 17 deletions src/hello.js
@@ -1,20 +1,13 @@
module.exports = (pluginContext) => {
return {
respondsTo: (query) => {
return query.match(/hello.*/)
},
search: (query, env = {}) => {
const name = query.split(/\s+/)[1] || ''
const title = name ? `Hello, ${name}!` : 'Hello!'
return new Promise((resolve, reject) => {
resolve([
{
icon: 'fa-hand-spock-o',
title,
subtitle: 'Please type your name!',
},
])
})
},
return (name, env = {}) => {
return new Promise((resolve, reject) => {
resolve([
{
icon: 'fa-hand-spock-o',
title: `Hello, ${name}!`,
subtitle: 'Please type your name!',
}
])
})
}
}
19 changes: 16 additions & 3 deletions zazu.json
Expand Up @@ -17,8 +17,21 @@
},
{
"id": "hello",
"type": "RootScript",
"script": "src/hello.js"
"type": "Keyword",
"keyword": "hello",
"title": "Hello!",
"subtitle": "Please type your name!",
"icon": "fa-hand-spock-o",
"connections": ["GoHome"]
},
{
"id": "hello-name",
"type": "PrefixScript",
"prefix": "hello",
"space": true,
"args": "Required",
"script": "src/hello.js",
"connections": ["GoHome"]
}
],
"output": [
Expand All @@ -29,4 +42,4 @@
}
]
}
}
}

0 comments on commit 1980965

Please sign in to comment.