Crates.io | dook |
lib.rs | dook |
version | 0.1.1 |
source | src |
created_at | 2024-07-01 03:32:04.408606 |
updated_at | 2024-07-27 20:56:10.288398 |
description | Look up definitions in your code |
homepage | https://github.com/pteromys/dook |
repository | https://github.com/pteromys/dook |
max_upload_size | |
id | 1288337 |
size | 105,333 |
Find code definitions using tree-sitter and ripgrep, and pretty-print them using bat.
Install ripgrep and bat. Build and install with:
cargo install --git https://github.com/pteromys/dook
pteromys@delia ~/src/dook $ dook write
───────┬────────────────────────────────────────────────────────────────
│ File: ./src/paging.rs
───────┼────────────────────────────────────────────────────────────────
61 │ impl std::io::Write for MaybePager {
... │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ 8< ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
69 │ fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
70 │ match self.pipe() {
71 │ Some(pipe) => pipe.write(buf),
72 │ None => std::io::stdout().write(buf),
73 │ }
74 │ }
───────┴────────────────────────────────────────────────────────────────
Also attempts to find assignments, class definitions, etc—because why should you have to figure out the difference before you search? In old javascript codebases there isn't really a difference anyway!
git grep -W 'def your_function_name\('
(or a language-specific analogue) is often good enough in a bunch of languages.cq
instead.)git grep -W
already gets mostly there so I care less)