diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-18 00:58:14 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-18 00:58:14 +0900 |
commit | 8a8222158cd2b2d2277b3cc956ad97517e64c65d (patch) | |
tree | f622f2748cc853a932615969ae956c96c3364359 /src/actions | |
parent | bf07e89126989cc555a10848ddf18589fffe2e49 (diff) | |
parent | 10bb350d849bf78d8811f11beb7f0bfb0e3ac03b (diff) |
Merge branch 'history-completion'
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/command.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/actions/command.js b/src/actions/command.js index 3e6eadb..3e879a6 100644 --- a/src/actions/command.js +++ b/src/actions/command.js @@ -1,4 +1,5 @@ import * as tabs from '../background/tabs'; +import * as histories from '../background/histories'; import * as consoleActions from './console'; const normalizeUrl = (string) => { @@ -39,9 +40,11 @@ const bufferCommand = (keywords) => { const doCommand = (name, remaining) => { switch (name) { + case 'o': case 'open': // TODO use search engined and pass keywords to them return openCommand(normalizeUrl(remaining)); + case 't': case 'tabopen': return tabopenCommand(normalizeUrl(remaining)); case 'b': @@ -53,6 +56,26 @@ const doCommand = (name, remaining) => { const getCompletions = (command, keywords) => { switch (command) { + case 'o': + case 'open': + case 't': + case 'tabopen': + return histories.getCompletions(keywords).then((pages) => { + let items = pages.map((page) => { + return { + caption: page.title, + content: page.url, + url: page.url + }; + }); + return [ + { + name: 'History', + items + } + ]; + }); + case 'b': case 'buffer': return tabs.getCompletions(keywords).then((gotTabs) => { let items = gotTabs.map((tab) => { |