-
Notifications
You must be signed in to change notification settings - Fork 0
/
ginol.js
82 lines (55 loc) · 1.69 KB
/
ginol.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env node
/** Guillaume Isabelle GINOL
* Vision: Simple notification are received and a simple command generates them
* Current Reality: Gulp notify mastery
*/
var defaultTimeOut = 6;
// var gulp = require("gulp");
// var notify = require("gulp-notify");
const notifier = require('node-notifier');
const path = require('path');
// String
//notifier.notify('Message');
var args = process.argv.slice(2);
var state = 0;
var msg = args[0];
if (args[0] == "-f" || args[0] == "--f" || args[0] == "--fail" || args[0] == "--failure") {
state = -1;
msg = args[1];
}
if (args[0] == "-s" || args[0] == "--s" || args[0] == "--success" || args[0] == "--succeeding") {
state = 1;
msg = args[1];
}
//@STCGoal Argument for FAILURE -f
//@STCGoal Argument for Success -s
//@Result Green = Success
var titleSuffix = "Ginol msg";
var title = titleSuffix;
var icon = 'Annotate_info.ico';
if (state == 0) { console.log(msg); }
else if (state == -1) {
console.warn("FAILURE:: " + msg);
title = "FAILURE::" + titleSuffix; icon = "Annotate_Warning.ico";
}
else if (state == 1) { console.log("SUCCESS:: " + msg); title = "SUCCESS::" + titleSuffix; icon = "112_RightArrowShort_Green.ico"; }
function notifyFunc(done) {
// gulp.src('./')
// .pipe(notify(msg,options)
// );
var iconpath = path.join(__dirname, icon);
// Object
notifier.notify({
title: title,
message: msg,
timeout: defaultTimeOut,
//wait: false,
icon: iconpath, // Absolute path (doesn't work on balloons)
// icon: icon, // Absolute Path to Triggering Icon
// open: "http://guillaumeisabelle.com"
});
}
// run our custom build
notifyFunc(function () {
console.log(title + "\n" + msg );
});