coffee-time 1.2.0-beta.5 → 1.2.0-beta.7
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/README.md +1 -1
- package/bin/coffee-time.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ coffee-time start --interval 45 --status
|
|
|
47
47
|
* Prints a single startup line:
|
|
48
48
|
`Coffee breaks scheduled every 45 minutes. Press Ctrl+C to stop.`
|
|
49
49
|
* Optional status flag (`--status`) prints a countdown update every minute:
|
|
50
|
-
|
|
50
|
+
`⏰ Next break in 44 minutes`
|
|
51
51
|
* Waits 45 minutes, then triggers a break notification.
|
|
52
52
|
* After each break, countdown updates continue when `--status` is enabled.
|
|
53
53
|
* Immediately schedules the next interval and repeats until you stop it (`Ctrl+C`).
|
package/bin/coffee-time.js
CHANGED
|
@@ -102,6 +102,13 @@ function formatRemaining(remainingMs) {
|
|
|
102
102
|
return `${minutes} ${unit}`;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
function supportsEmoji() {
|
|
106
|
+
return process.env.TERM_PROGRAM === 'Apple_Terminal'
|
|
107
|
+
|| Boolean(process.env.WT_SESSION)
|
|
108
|
+
|| process.env.TERM_PROGRAM === 'vscode'
|
|
109
|
+
|| process.platform === 'win32';
|
|
110
|
+
}
|
|
111
|
+
|
|
105
112
|
function printCoffeeArt() {
|
|
106
113
|
const frames = [
|
|
107
114
|
[
|
|
@@ -174,6 +181,7 @@ function startLoop(intervalMinutes, options = {}) {
|
|
|
174
181
|
let statusLength = 0;
|
|
175
182
|
let statusActive = false;
|
|
176
183
|
let stopCoffeeArt = () => {};
|
|
184
|
+
const clock = supportsEmoji() ? '⏰' : '[next]';
|
|
177
185
|
|
|
178
186
|
const logLine = (message) => {
|
|
179
187
|
if (statusActive) {
|
|
@@ -196,7 +204,7 @@ function startLoop(intervalMinutes, options = {}) {
|
|
|
196
204
|
|
|
197
205
|
const logStatus = () => {
|
|
198
206
|
const remaining = nextTime - Date.now();
|
|
199
|
-
const message =
|
|
207
|
+
const message = `${clock} Next break in ${formatRemaining(remaining)}`;
|
|
200
208
|
const paddedMessage = message.padEnd(statusLength, ' ');
|
|
201
209
|
process.stdout.write(`\r${paddedMessage}`);
|
|
202
210
|
statusLength = message.length;
|