@timmy6942025/cli-timer 1.1.6 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/package.json +1 -1
  3. package/src/index.js +19 -13
package/README.md CHANGED
@@ -55,18 +55,16 @@ By default, timer and stopwatch output is centered in the terminal.
55
55
 
56
56
  You can view and set the ASCII font style used for the timer and stopwatch display.
57
57
 
58
- To list all available fonts:
58
+ To list timer-compatible fonts (recommended):
59
59
 
60
60
  ```bash
61
61
  timer style
62
62
  ```
63
63
 
64
- This is instant and lists all figlet fonts.
65
-
66
- To list only timer-compatible fonts (fonts that render `00:00:00` visibly):
64
+ To list every figlet font:
67
65
 
68
66
  ```bash
69
- timer style --compatible
67
+ timer style --all
70
68
  ```
71
69
 
72
70
  To set your preferred font:
@@ -107,6 +105,8 @@ This launches a Bubble Tea based screen where you can change:
107
105
  - Restart key
108
106
  - Exit key / exit alt key
109
107
 
108
+ The settings UI font picker now shows timer-compatible fonts only.
109
+
110
110
  Controls in settings UI:
111
111
 
112
112
  - `Enter`: select/toggle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmy6942025/cli-timer",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Simple customizable terminal timer and stopwatch",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -10,7 +10,8 @@ const CONFIG_DIR = path.join(os.homedir(), ".cli-timer");
10
10
  const CONFIG_PATH = path.join(CONFIG_DIR, "config.json");
11
11
  const SETTINGS_STATE_PATH = path.join(CONFIG_DIR, "settings-state.json");
12
12
  const DEFAULT_FONT = "Standard";
13
- const TIMER_SAMPLE_TEXT = "00:00:00";
13
+ const TIMER_SAMPLE_TEXT = "01:23:45";
14
+ const MIN_FIGLET_WIDTH = 120;
14
15
 
15
16
  const MIN_TICK_RATE_MS = 50;
16
17
  const MAX_TICK_RATE_MS = 1000;
@@ -86,12 +87,16 @@ function hasVisibleGlyphs(text) {
86
87
  }
87
88
 
88
89
  function renderWithFont(text, fontName) {
90
+ const width = Number.isFinite(process.stdout.columns)
91
+ ? Math.max(MIN_FIGLET_WIDTH, Math.floor(process.stdout.columns))
92
+ : MIN_FIGLET_WIDTH;
93
+
89
94
  try {
90
95
  return figlet.textSync(text, {
91
96
  font: fontName,
92
97
  horizontalLayout: "fitted",
93
98
  verticalLayout: "default",
94
- width: process.stdout.columns || 120,
99
+ width,
95
100
  whitespaceBreak: true
96
101
  });
97
102
  } catch (_error) {
@@ -973,7 +978,7 @@ function runSettingsUI() {
973
978
  const state = {
974
979
  configPath: CONFIG_PATH,
975
980
  config: readConfig(),
976
- fonts: getAllFonts()
981
+ fonts: getTimerCompatibleFontsSlow()
977
982
  };
978
983
 
979
984
  fs.writeFileSync(SETTINGS_STATE_PATH, JSON.stringify(state), "utf8");
@@ -1040,7 +1045,7 @@ function printUsage() {
1040
1045
  process.stdout.write(" Keybindings are customizable in `timer settings`.\n\n");
1041
1046
  process.stdout.write("Font Styles\n");
1042
1047
  process.stdout.write(" timer style\n");
1043
- process.stdout.write(" timer style --compatible\n");
1048
+ process.stdout.write(" timer style --all\n");
1044
1049
  process.stdout.write(" timer style <font>\n");
1045
1050
  }
1046
1051
 
@@ -1062,28 +1067,29 @@ function runTimer(args) {
1062
1067
  }
1063
1068
 
1064
1069
  if (args[0] === "style") {
1065
- if (args.length === 1 || (args.length === 2 && args[1] === "--all")) {
1070
+ if (args.length === 1 || (args.length === 2 && args[1] === "--compatible")) {
1071
+ process.stdout.write("Checking font compatibility for timer digits...\n\n");
1066
1072
  const currentFont = getFontFromConfig();
1067
- const fonts = getAllFonts();
1073
+ const fonts = getTimerCompatibleFontsSlow();
1068
1074
  process.stdout.write(`Current font: ${currentFont}\n\n`);
1069
- process.stdout.write("Available fonts:\n");
1075
+ process.stdout.write("Timer-compatible fonts:\n");
1070
1076
  for (const font of fonts) {
1071
1077
  process.stdout.write(`${font}\n`);
1072
1078
  }
1073
- process.stdout.write("\nTip: Some fonts do not support timer digits.\n");
1074
- process.stdout.write("Use `timer style <font>` to validate and set safely.\n");
1079
+ process.stdout.write("\nUse `timer style --all` to list every figlet font.\n");
1075
1080
  return;
1076
1081
  }
1077
1082
 
1078
- if (args.length === 2 && args[1] === "--compatible") {
1079
- process.stdout.write("Checking font compatibility for timer digits...\n\n");
1083
+ if (args.length === 2 && args[1] === "--all") {
1080
1084
  const currentFont = getFontFromConfig();
1081
- const fonts = getTimerCompatibleFontsSlow();
1085
+ const fonts = getAllFonts();
1082
1086
  process.stdout.write(`Current font: ${currentFont}\n\n`);
1083
- process.stdout.write("Timer-compatible fonts:\n");
1087
+ process.stdout.write("All fonts:\n");
1084
1088
  for (const font of fonts) {
1085
1089
  process.stdout.write(`${font}\n`);
1086
1090
  }
1091
+ process.stdout.write("\nSome fonts do not support timer digits.\n");
1092
+ process.stdout.write("Use `timer style` for a safe compatible list.\n");
1087
1093
  return;
1088
1094
  }
1089
1095