fix(generic): tabtab install breaks in bash for windows

This commit is contained in:
Samuel Attard 2018-01-08 11:41:54 +11:00
Родитель 4d5378c221
Коммит a5f8b40f02
1 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -1,16 +1,21 @@
const Complete = require('tabtab/src/complete');
const Installer = require('tabtab/src/installer');
try {
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);
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];
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`);
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`);
}
} catch (err) {
console.log('tabtab install went wrong', err);
process.exit(0);
}