coffee-time 1.2.0-beta.4 → 1.2.0-beta.6

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 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
- `⏳ Next break in 44:00`
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`).
@@ -97,9 +97,15 @@ function notify(intervalMinutes, logLine = console.log) {
97
97
 
98
98
  function formatRemaining(remainingMs) {
99
99
  const totalSeconds = Math.max(0, Math.ceil(remainingMs / 1000));
100
- const minutes = Math.floor(totalSeconds / 60);
101
- const seconds = totalSeconds % 60;
102
- return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
100
+ const minutes = Math.max(0, Math.ceil(totalSeconds / 60));
101
+ const unit = minutes === 1 ? 'minute' : 'minutes';
102
+ return `${minutes} ${unit}`;
103
+ }
104
+
105
+ function supportsEmoji() {
106
+ return process.env.TERM_PROGRAM === 'Apple_Terminal'
107
+ || Boolean(process.env.WT_SESSION)
108
+ || process.env.TERM_PROGRAM === 'vscode';
103
109
  }
104
110
 
105
111
  function printCoffeeArt() {
@@ -174,6 +180,7 @@ function startLoop(intervalMinutes, options = {}) {
174
180
  let statusLength = 0;
175
181
  let statusActive = false;
176
182
  let stopCoffeeArt = () => {};
183
+ const clock = supportsEmoji() ? '⏰' : '[next]';
177
184
 
178
185
  const logLine = (message) => {
179
186
  if (statusActive) {
@@ -196,7 +203,7 @@ function startLoop(intervalMinutes, options = {}) {
196
203
 
197
204
  const logStatus = () => {
198
205
  const remaining = nextTime - Date.now();
199
- const message = `⏰ Next break in ${formatRemaining(remaining)}`;
206
+ const message = `${clock} Next break in ${formatRemaining(remaining)}`;
200
207
  const paddedMessage = message.padEnd(statusLength, ' ');
201
208
  process.stdout.write(`\r${paddedMessage}`);
202
209
  statusLength = message.length;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.2.0-beta.4",
6
+ "version": "1.2.0-beta.6",
7
7
  "description": "Lightweight CLI to schedule coffee breaks at a fixed interval.",
8
8
  "bin": {
9
9
  "coffee-time": "./bin/coffee-time.js"