@kaynooo/cli-pick 0.6.1 → 0.7.0
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/dist/pick.js +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ bun add -g @kaynooo/cli-pick
|
|
|
14
14
|
| `ls \| pick --preview 'head -20 {}'` | a pane on the right (terminal at least 80 columns) shows the command run for the highlighted line, `{}` shell-quoted |
|
|
15
15
|
| `--height 12`, `--height 60%` | lines or a share of the terminal to draw in (40%) |
|
|
16
16
|
|
|
17
|
-
Keys: type to filter, up and down or ctrl-p and ctrl-n to move, enter to pick, esc or ctrl-c to cancel (exit 1, nothing printed), ctrl-u clears the query, ctrl-w deletes a word, ctrl-/ or f1 opens a legend of the keys until the next key.
|
|
17
|
+
Keys: type to filter, up and down or ctrl-p and ctrl-n to move, enter to pick, esc or ctrl-c to cancel (exit 1, nothing printed), ctrl-u clears the query, ctrl-w deletes a word, ctrl-/ or f1 opens a legend of the keys until the next key. The count line ends in a `ctrl-/ keys` hint, and the characters a query matched are underlined.
|
|
18
18
|
|
|
19
19
|
The query matches as a subsequence, best first: a word start, a run of consecutive characters or a prefix scores higher, a lowercase query ignores case and an uppercase letter makes it exact. Keys come from `/dev/tty` and the selector is drawn on stderr, so a pipe or a command substitution takes only the choice. Without a terminal on stderr it exits 2.
|
|
20
20
|
|
package/dist/pick.js
CHANGED
|
@@ -328,13 +328,13 @@ function userConfigPath(bin, where = {}) {
|
|
|
328
328
|
// ../kit/src/theme.ts
|
|
329
329
|
var DEFAULT = {
|
|
330
330
|
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
331
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
|
|
331
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
|
|
332
332
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
333
333
|
bins: {}
|
|
334
334
|
};
|
|
335
335
|
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
336
336
|
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
337
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
|
|
337
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
|
|
338
338
|
var PRESETS = {
|
|
339
339
|
default: {},
|
|
340
340
|
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
@@ -1448,7 +1448,7 @@ function listLines(state, layout, theme) {
|
|
|
1448
1448
|
const promptWidth = Bun.stringWidth(state.prompt);
|
|
1449
1449
|
const query = fit(state.query, Math.max(1, layout.listWidth - promptWidth), identity);
|
|
1450
1450
|
const place = state.matches.length > rows ? ` (${state.cursor + 1} of ${state.matches.length})` : "";
|
|
1451
|
-
const count = fit(` ${state.matches.length}/${state.items.length}${place}${marks}`, layout.listWidth, theme.label);
|
|
1451
|
+
const count = fit(` ${state.matches.length}/${state.items.length}${place}${marks} ctrl-/ keys`, layout.listWidth, theme.label);
|
|
1452
1452
|
const lines = [{ text: theme.accent(state.prompt) + query.text, width: promptWidth + query.width }, count, ...header];
|
|
1453
1453
|
if (state.matches.length === 0)
|
|
1454
1454
|
lines.push(fit(" no match", layout.listWidth, theme.label));
|
|
@@ -1456,7 +1456,7 @@ function listLines(state, layout, theme) {
|
|
|
1456
1456
|
const current = top + offset === state.cursor;
|
|
1457
1457
|
const pointer = current ? theme.accent("\u276F") : " ";
|
|
1458
1458
|
const mark = state.multi ? `${state.marked.has(match.index) ? theme.id("\u25CF") : " "} ` : "";
|
|
1459
|
-
const text = fit(state.items[match.index], layout.listWidth - prefixWidth, current ? theme.value : identity, theme.accent, new Set(match.positions), state.styles[match.index]);
|
|
1459
|
+
const text = fit(state.items[match.index], layout.listWidth - prefixWidth, current ? theme.value : identity, theme.match ?? theme.accent, new Set(match.positions), state.styles[match.index]);
|
|
1460
1460
|
lines.push({ text: `${pointer} ${mark}${text.text}`, width: prefixWidth + text.width });
|
|
1461
1461
|
}
|
|
1462
1462
|
return lines;
|
|
@@ -1512,7 +1512,7 @@ function openTerminal() {
|
|
|
1512
1512
|
get rows() {
|
|
1513
1513
|
return out.rows || 24;
|
|
1514
1514
|
},
|
|
1515
|
-
theme: { accent: role("accent", out), label: role("label", out), value: role("value", out), id: role("id", out) },
|
|
1515
|
+
theme: { accent: role("accent", out), label: role("label", out), value: role("value", out), id: role("id", out), match: (text) => paint(out).underline(role("accent", out)(text)) },
|
|
1516
1516
|
write: (text) => void out.write(text),
|
|
1517
1517
|
listen(onChunk, onResize) {
|
|
1518
1518
|
resize = onResize;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-pick",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"description": "pick: a themed fuzzy selector, lines on stdin, the chosen one on stdout.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
"pick": "$npm_execpath src/pick.ts"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@kaynooo/cli-kit": "0.
|
|
38
|
+
"@kaynooo/cli-kit": "0.28.0"
|
|
39
39
|
}
|
|
40
40
|
}
|