Skip to content

Commit

Permalink
fix: Skip completion install for win32 platform or unknown shell
Browse files Browse the repository at this point in the history
  • Loading branch information
mklabs committed May 9, 2016
1 parent 0393087 commit c4f6073
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 11 additions & 0 deletions lib/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ export default class Commands {
install(options) {
options = options || {};
var script = this.complete.script(this.name, this.name || 'tabtab');

if (process.platform === 'win32') {
return debug('Windows shell completion not yet supported, skipping completion install');
}

var shell = process.env.SHELL;
if (shell) shell = shell.split('/').slice(-1)[0];
if (!this.installer[shell]) {
return debug('User shell %s not supported, skipping completion install', shell);
}

this.installer
.handle(this.options.name || this.complete.resolve('name'), options)
.catch((e) => {
Expand Down
4 changes: 0 additions & 4 deletions lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ export default class Installer {
return new Promise((r, errback) => {
var shell = process.env.SHELL;
if (shell) shell = shell.split('/').slice(-1)[0];
if (!this[shell]) {
debug('User shell %s not supported', shell);
return errback(new Error('Shell not supported: ' + shell));
}

return this[shell]().then(r)
.catch(errback);
Expand Down

0 comments on commit c4f6073

Please sign in to comment.