Add presets: file:line:col, hex, mdlink, hostport, jwt, ... #6

Open
opened 2026-09-19 16:33:41 +09:00 by natsukium · 0 comments
Owner

Summary

Add presets for the pick targets that come up as often as the current seven, keeping the
"permissive, best-effort, human-then-picks" dialect src/preset.rs documents.

Current list: url, email, ipv4, ipv6, path, sha, uuid.

Candidates

  • file:line[:col]src/main.rs:140:5. The one that pairs with an action:
    --preset filepos --action '$EDITOR +{}'-ish. Compiler, linter, grep and test output all emit it.
  • hex#rrggbb / #rgb colours.
  • mdlink — markdown [text](url), with --capture reaching the URL.
  • hostporthost:port, for logs and ss/docker ps output.
  • jwt — three base64url runs separated by dots.
  • k8s — pod/deployment-style names from kubectl get output.
  • number — bare integers; thumbs has it and it is occasionally what you want.

Notes

  • Presets are named shortcuts for a regex and nothing more, so each addition is a row in
    PRESETS plus its test; the cost is in choosing a dialect that is wide enough to be useful and
    narrow enough not to swamp the screen with labels.
  • Order in PRESETS is the overlap tie-break order (earlier wins), so a new entry's placement is
    a decision, not a formality — e.g. filepos must come before path, or path eats its prefix.
  • Principle 5 is unaffected: still nothing matches unless named.
## Summary Add presets for the pick targets that come up as often as the current seven, keeping the "permissive, best-effort, human-then-picks" dialect `src/preset.rs` documents. Current list: `url, email, ipv4, ipv6, path, sha, uuid`. ## Candidates - **`file:line[:col]`** — `src/main.rs:140:5`. The one that pairs with an action: `--preset filepos --action '$EDITOR +{}'`-ish. Compiler, linter, grep and test output all emit it. - **`hex`** — `#rrggbb` / `#rgb` colours. - **`mdlink`** — markdown `[text](url)`, with `--capture` reaching the URL. - **`hostport`** — `host:port`, for logs and `ss`/`docker ps` output. - **`jwt`** — three base64url runs separated by dots. - **`k8s`** — pod/deployment-style names from `kubectl get` output. - **`number`** — bare integers; thumbs has it and it is occasionally what you want. ## Notes - Presets are named shortcuts for a regex and nothing more, so each addition is a row in `PRESETS` plus its test; the cost is in choosing a dialect that is wide enough to be useful and narrow enough not to swamp the screen with labels. - Order in `PRESETS` is the overlap tie-break order (earlier wins), so a new entry's placement is a decision, not a formality — e.g. `filepos` must come before `path`, or `path` eats its prefix. - Principle 5 is unaffected: still nothing matches unless named.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
natsukium/spoor#6
No description provided.