@arthony/keybook 0.1.1 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +14 -3
  2. package/dist/cli.js +25 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,14 +9,25 @@ shortcuts along the way.
9
9
 
10
10
  ## Install
11
11
 
12
+ ```bash
13
+ brew install ariyapong/tap/keybook
14
+ ```
15
+
16
+ Or via npm:
17
+
12
18
  ```bash
13
19
  npm install -g @arthony/keybook
14
20
  # or run without installing:
15
- npx @arthony/keybook
21
+ npx -p @arthony/keybook keybook
16
22
  ```
17
23
 
18
- Requires Node 22+ and macOS. The package is published under the `@arthony`
19
- scope, but the commands it installs are still `keybook` (and the `kb` alias).
24
+ Requires macOS. The Homebrew tap installs Node 22 automatically; the npm
25
+ route assumes you already have Node 22+. Both install the `keybook`
26
+ command and the `kb` alias.
27
+
28
+ **Terminal.app users:** if `⌥⌫` doesn't delete a word in the search input,
29
+ enable *Terminal → Settings → Profiles → Keyboard → "Use Option as Meta
30
+ key"*, or use `⌃W` (works in any terminal).
20
31
 
21
32
  ## Usage
22
33
 
package/dist/cli.js CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  // src/cli.ts
4
4
  import { spawn } from "child_process";
5
+ import { readFileSync as readFileSync2 } from "fs";
6
+ import { dirname as dirname2, join as join3 } from "path";
7
+ import { fileURLToPath as fileURLToPath2 } from "url";
5
8
  import { Command } from "commander";
6
9
  import { render } from "ink";
7
10
  import { createElement } from "react";
@@ -163,7 +166,7 @@ function Footer({
163
166
  }) {
164
167
  return /* @__PURE__ */ jsxs(Box, { marginTop: 1, justifyContent: "space-between", children: [
165
168
  /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
166
- "\u2191\u2193 move \u23CE copy \u238B quit (",
169
+ "\u2191\u2193 move \u23CE copy \u238B quit \u2325\u232B/\u2303W del word \u2303U clear (",
167
170
  resultCount,
168
171
  ")"
169
172
  ] }),
@@ -307,6 +310,14 @@ function SearchInput({ query }) {
307
310
  ] });
308
311
  }
309
312
 
313
+ // src/tui/input.ts
314
+ function deleteWordBack(query) {
315
+ const trimmed = query.replace(/\s+$/, "");
316
+ const lastSpace = trimmed.lastIndexOf(" ");
317
+ if (lastSpace === -1) return "";
318
+ return trimmed.slice(0, lastSpace + 1);
319
+ }
320
+
310
321
  // src/tui/layout.ts
311
322
  var RESERVED_ROWS = 4;
312
323
  function visibleListHeight(terminalRows) {
@@ -353,6 +364,16 @@ function App({ entries, errorCount = 0, onCopy = copyToClipboard }) {
353
364
  }
354
365
  return;
355
366
  }
367
+ if (key.meta && (key.backspace || key.delete) || key.ctrl && input === "w") {
368
+ setQuery(deleteWordBack);
369
+ setSelected(0);
370
+ return;
371
+ }
372
+ if (key.ctrl && input === "u") {
373
+ setQuery("");
374
+ setSelected(0);
375
+ return;
376
+ }
356
377
  if (key.backspace || key.delete) {
357
378
  setQuery((q) => q.slice(0, -1));
358
379
  setSelected(0);
@@ -383,8 +404,10 @@ function App({ entries, errorCount = 0, onCopy = copyToClipboard }) {
383
404
  }
384
405
 
385
406
  // src/cli.ts
407
+ var pkgPath = join3(dirname2(fileURLToPath2(import.meta.url)), "..", "package.json");
408
+ var pkg = JSON.parse(readFileSync2(pkgPath, "utf8"));
386
409
  var program = new Command();
387
- program.name("keybook").description("Search keyboard shortcuts & recipes for your apps").version("0.1.0");
410
+ program.name("keybook").description("Search keyboard shortcuts & recipes for your apps").version(pkg.version);
388
411
  program.command("path").description("Print the data directory").action(() => {
389
412
  console.log(runPath());
390
413
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arthony/keybook",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },