genbox 1.0.105 → 1.0.106
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/dist/commands/list.js +13 -7
- package/package.json +1 -1
package/dist/commands/list.js
CHANGED
|
@@ -60,25 +60,31 @@ exports.listCommand = new commander_1.Command('list')
|
|
|
60
60
|
// Show project info when listing all
|
|
61
61
|
const projectSuffix = options.all && genbox.project ? ` [${genbox.project}]` : '';
|
|
62
62
|
const nameWithProject = genbox.name + projectSuffix;
|
|
63
|
-
// Format end hour as relative time
|
|
63
|
+
// Format end hour as relative time (destroy happens at 58 min mark, not 60)
|
|
64
64
|
let endHourInfo = '';
|
|
65
65
|
if (genbox.currentHourEnd && genbox.status === 'running') {
|
|
66
66
|
const endTime = new Date(genbox.currentHourEnd);
|
|
67
67
|
const now = new Date();
|
|
68
|
-
|
|
68
|
+
// Subtract 2 minutes since auto-destroy happens at 58 min mark
|
|
69
|
+
const destroyTime = endTime.getTime() - (2 * 60 * 1000);
|
|
70
|
+
const diffMs = destroyTime - now.getTime();
|
|
69
71
|
if (diffMs > 0) {
|
|
70
72
|
const totalSeconds = Math.floor(diffMs / 1000);
|
|
71
73
|
const mins = Math.floor(totalSeconds / 60);
|
|
72
74
|
const secs = totalSeconds % 60;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
const timeStr = mins > 0
|
|
76
|
+
? `${mins}m:${secs.toString().padStart(2, '0')}s`
|
|
77
|
+
: `${secs}s`;
|
|
78
|
+
// Red color if less than 5 minutes
|
|
79
|
+
if (mins < 5) {
|
|
80
|
+
endHourInfo = chalk_1.default.red(` hour ends in ${timeStr}`);
|
|
75
81
|
}
|
|
76
82
|
else {
|
|
77
|
-
endHourInfo = ` hour ends in ${
|
|
83
|
+
endHourInfo = chalk_1.default.dim(` hour ends in ${timeStr}`);
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
86
|
else {
|
|
81
|
-
endHourInfo = ' hour
|
|
87
|
+
endHourInfo = chalk_1.default.red(' hour ending...');
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
// Show auto-destroy status
|
|
@@ -105,7 +111,7 @@ exports.listCommand = new commander_1.Command('list')
|
|
|
105
111
|
const statusPart = statusColor(genbox.status.padEnd(statusWidth));
|
|
106
112
|
const ipPart = chalk_1.default.dim((genbox.ipAddress || 'Pending IP').padEnd(ipWidth));
|
|
107
113
|
const sizePart = `(${genbox.size})`.padEnd(sizeWidth);
|
|
108
|
-
const extraInfo =
|
|
114
|
+
const extraInfo = endHourInfo + protectedInfo;
|
|
109
115
|
console.log(`${namePart} ${statusPart} ${ipPart} ${sizePart}${extraInfo}`);
|
|
110
116
|
});
|
|
111
117
|
console.log(chalk_1.default.dim('────────────────────────────────────────────────────'));
|