coffee-time 1.2.0-beta.7 → 1.2.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/coffee-time.js +14 -1
- package/package.json +1 -1
package/bin/coffee-time.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { spawn } = require('child_process');
|
|
4
|
+
const os = require('os');
|
|
4
5
|
|
|
5
6
|
const USAGE_ERROR = 2;
|
|
6
7
|
|
|
@@ -102,11 +103,23 @@ function formatRemaining(remainingMs) {
|
|
|
102
103
|
return `${minutes} ${unit}`;
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
function isWindowsLike() {
|
|
107
|
+
return process.platform === 'win32'
|
|
108
|
+
|| /microsoft/i.test(os.release());
|
|
109
|
+
}
|
|
110
|
+
|
|
105
111
|
function supportsEmoji() {
|
|
112
|
+
if (process.env.COFFEE_TIME_FORCE_ASCII === '1') {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
if (process.env.COFFEE_TIME_FORCE_EMOJI === '1') {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
|
|
106
119
|
return process.env.TERM_PROGRAM === 'Apple_Terminal'
|
|
107
120
|
|| Boolean(process.env.WT_SESSION)
|
|
108
121
|
|| process.env.TERM_PROGRAM === 'vscode'
|
|
109
|
-
||
|
|
122
|
+
|| isWindowsLike();
|
|
110
123
|
}
|
|
111
124
|
|
|
112
125
|
function printCoffeeArt() {
|