aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-05-10 22:23:53 +0900
committerGitHub <noreply@github.com>2018-05-10 22:23:53 +0900
commitb0dddc9fa7765dc252fd11fc7d0fe52820655fd5 (patch)
tree9abdb374752d39866af93981e05b52c675f98d05 /src
parent439c2a3df9c70c0baa26e2c9d597e109348e5499 (diff)
parent7bb9856dd2f10e84e4cd66dd50c8c6c9d6274508 (diff)
Merge pull request #348 from luanpotter/q_command_close_tab
implement :q to close tab
Diffstat (limited to 'src')
-rw-r--r--src/background/actions/command.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/background/actions/command.js b/src/background/actions/command.js
index be742cd..2b77507 100644
--- a/src/background/actions/command.js
+++ b/src/background/actions/command.js
@@ -19,6 +19,12 @@ const tabopenCommand = (url) => {
return browser.tabs.create({ url: url });
};
+const tabcloseCommand = () => {
+ return browser.tabs.query({ active: true }).then((tabList) => {
+ return browser.tabs.remove(tabList.map(tab => tab.id));
+ });
+};
+
const winopenCommand = (url) => {
return browser.windows.create({ url });
};
@@ -93,6 +99,9 @@ const exec = (tab, line, settings) => {
});
case 'set':
return setCommand(args);
+ case 'q':
+ case 'quit':
+ return tabcloseCommand();
case '':
return Promise.resolve();
}