diff options
Diffstat (limited to 'src/background/actions')
-rw-r--r-- | src/background/actions/command.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/background/actions/command.js b/src/background/actions/command.js index e46a97e..be742cd 100644 --- a/src/background/actions/command.js +++ b/src/background/actions/command.js @@ -1,3 +1,4 @@ +import messages from 'shared/messages'; import actions from '../actions'; import * as tabs from '../shared/tabs'; import * as bookmarks from '../shared/bookmarks'; @@ -45,7 +46,7 @@ const addBookmarkCommand = (tab, args) => { return Promise.resolve(); } - return bookmarks.create(args[0], tab.url); + return bookmarks.create(args.join(' '), tab.url); }; const setCommand = (args) => { @@ -78,7 +79,18 @@ const exec = (tab, line, settings) => { case 'buffer': return bufferCommand(args); case 'addbookmark': - return addBookmarkCommand(tab, args); + return addBookmarkCommand(tab, args).then((item) => { + if (!item) { + return browser.tabs.sendMessage(tab.id, { + type: messages.CONSOLE_SHOW_ERROR, + text: 'Could not create a bookmark', + }); + } + return browser.tabs.sendMessage(tab.id, { + type: messages.CONSOLE_SHOW_INFO, + text: 'Saved current page: ' + item.url, + }); + }); case 'set': return setCommand(args); case '': |