-
Notifications
You must be signed in to change notification settings - Fork 13
/
install.js
executable file
·37 lines (30 loc) · 996 Bytes
/
install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const { log, success, error } = require('./utils/common');
const configs = new Map([
[ 'bash', `${process.env.HOME}/.bashrc` ],
[ 'zsh' , `${process.env.HOME}/.zshrc` ],
[ 'fish', `${process.env.HOME}/.config/fish/config.fish` ],
]);
log('Installing robbyrussell theme...');
const shell = path.basename(process.env.SHELL);
const cwd = process.cwd();
const config = configs.get(shell);
log('Current shell:', shell);
log('Working directory:', cwd);
log('Shell\'s config stored at:', config);
try {
log(`Appending to ${config}...`);
fs.appendFileSync(config, `
### GENERATED BY ROBBYRUSSELL
. ${cwd}/adapters/adapter.${shell}
### GENERATED BY ROBBYRUSSELL
`, 'utf8');
success('Done! Please, reload your terminal.');
} catch (e) {
error('Something went wrong!');
error('Don\'t panic! Report an issue to:');
error('\n\thttps://github.com/denysdovhan/robbyrussell-node/issues/new');
throw e;
}