@timmy6942025/cli-timer 1.1.10 → 1.1.11
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 +6 -0
- package/package.json +1 -1
- package/src/index.js +19 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1198,6 +1198,7 @@ function printUsage() {
|
|
|
1198
1198
|
process.stdout.write(" timer style\n");
|
|
1199
1199
|
process.stdout.write(" timer style --all\n");
|
|
1200
1200
|
process.stdout.write(" timer style --compatible\n");
|
|
1201
|
+
process.stdout.write(" timer style random\n");
|
|
1201
1202
|
process.stdout.write(" timer style <font>\n");
|
|
1202
1203
|
}
|
|
1203
1204
|
|
|
@@ -1244,6 +1245,24 @@ function runTimer(args) {
|
|
|
1244
1245
|
return;
|
|
1245
1246
|
}
|
|
1246
1247
|
|
|
1248
|
+
if (args.length === 2 && args[1].toLowerCase() === "random") {
|
|
1249
|
+
const fonts = getAllFonts();
|
|
1250
|
+
if (fonts.length === 0) {
|
|
1251
|
+
process.stderr.write("No fonts are available.\n");
|
|
1252
|
+
process.exitCode = 1;
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
const randomFont = fonts[Math.floor(Math.random() * fonts.length)];
|
|
1256
|
+
const result = setFontInConfig(randomFont);
|
|
1257
|
+
if (!result.ok) {
|
|
1258
|
+
process.stderr.write(`Failed to set random font: ${randomFont}\n`);
|
|
1259
|
+
process.exitCode = 1;
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
process.stdout.write(`Random font set to: ${result.font}\n`);
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1247
1266
|
const requestedFont = args.slice(1).join(" ");
|
|
1248
1267
|
const result = setFontInConfig(requestedFont);
|
|
1249
1268
|
if (!result.ok) {
|