Skip to content
Permalink
Browse files

chore(generic): don't nonzero-exit when trying to install tabtab comp…

…letions

Copies the installation code from tabtab, except it only warns instead of nonzero exits when an
error occurs.

ISSUES CLOSED: #321
  • Loading branch information
malept committed Dec 6, 2017
1 parent f681176 commit 0e18fe34963292a91019423d98c7466845ff8cfb
Showing with 16 additions and 7 deletions.
  1. +1 −1 package.json
  2. +15 −6 tabtab-install.js
@@ -16,7 +16,7 @@
"commit": "git-cz",
"docs": "esdoc",
"install": "node tabtab-install.js",
"lint": "eslint src test gulpfile.babel.js",
"lint": "eslint src test gulpfile.babel.js tabtab-install.js",
"prepublish": "gulp build",
"pretest": "gulp build",
"test": "npm run lint && npm run test-all",
@@ -1,7 +1,16 @@
process.argv.push('install');
process.argv.push('--auto');
try {
require('tabtab/src/cli');
} catch (e) {
console.warn(`Failed to install tab completion: ${e}`);
const Complete = require('tabtab/src/complete');
const Installer = require('tabtab/src/installer');

const options = { auto: true, name: 'electron-forge' };
const complete = new Complete(options);
const installer = new Installer(options, complete);

let shell = process.env.SHELL;
if (shell) shell = shell.split((process.platform !== 'win32') ? '/' : '\\').slice(-1)[0];

if (installer[shell]) {
installer.handle(options.name, options)
.catch(e => console.warn(`Failed to install tab completion: ${e}`));
} else {
console.warn(`User shell ${shell} not supported, skipping completion install`);
}

0 comments on commit 0e18fe3

Please sign in to comment.
You can’t perform that action at this time.