@timmy6942025/cli-timer 1.1.6 → 1.1.8
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/package.json +1 -1
- package/src/index.js +8 -2
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ timer style
|
|
|
63
63
|
|
|
64
64
|
This is instant and lists all figlet fonts.
|
|
65
65
|
|
|
66
|
-
To list only timer-compatible fonts (fonts that render `
|
|
66
|
+
To list only timer-compatible fonts (fonts that render `01:23:45` visibly):
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
69
|
timer style --compatible
|
package/package.json
CHANGED
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 = "
|
|
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
|
|
99
|
+
width,
|
|
95
100
|
whitespaceBreak: true
|
|
96
101
|
});
|
|
97
102
|
} catch (_error) {
|
|
@@ -1040,6 +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");
|
|
1048
|
+
process.stdout.write(" timer style --all\n");
|
|
1043
1049
|
process.stdout.write(" timer style --compatible\n");
|
|
1044
1050
|
process.stdout.write(" timer style <font>\n");
|
|
1045
1051
|
}
|