forked from anabastos/daledale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
路39 lines (31 loc) 路 1.05 KB
/
index.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
38
39
#!/usr/bin/env node
const exect = require('child_process').exec;
const path = require('path');
const fs = require('fs');
const R = require('ramda');
const mainPath = path.dirname(fs.realpathSync(__filename));
const soundPath = path.join(mainPath, './vem-tranquilo');
const daledale = function (){
const linuxcmd = R.join('', ['paplay ', soundPath, '.ogg']);
const windowscmd = R.join('', [path.join(mainPath, './forWindows.vbs'), ' ', soundPath, '.mp3']);
const maccmd = R.join('', ['afplay ', soundPath, '.mp3']);
const platform = process.platform;
R.cond([
[R.equals('linux'), exec(linuxcmd)],
[R.equals('win32'), exec(windowscmd)],
[R.equals('darwin'), exec(maccmd)],
], platform)
function exec(cmd){
return exect(cmd, function (error) {
R.ifElse(
R.empty,
() => console.log('VEM TRANQUILO VEM TRANQUILO!'),
(error) => console.error(error),
error)
});
}
}
module.exports = daledale;
if (!module.parent) {
daledale();
}