diff --git a/Cargo.lock b/Cargo.lock index caf1966..9bda807 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -200,6 +200,15 @@ dependencies = [ "strsim", ] +[[package]] +name = "clap_complete" +version = "4.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037e2a1a92236d0aff7e845093f64661d6df4c02c9fcc61a60e9e1d736fa392f" +dependencies = [ + "clap", +] + [[package]] name = "clap_derive" version = "4.6.4" @@ -218,6 +227,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" +[[package]] +name = "clap_mangen" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e30ffc187e2e3aeafcd1c6e2aa416e29739454c0ccaa419226d5ecd181f2d78" +dependencies = [ + "clap", + "roff", +] + [[package]] name = "colorchoice" version = "1.0.5" @@ -1204,14 +1223,17 @@ dependencies = [ [[package]] name = "ratfetch" -version = "0.1.0" +version = "0.2.0" dependencies = [ "clap", + "clap_complete", + "clap_mangen", "crossterm", "dirs", "libc", "ratatui", "serde", + "serde_json", "toml", ] @@ -1264,6 +1286,12 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" +[[package]] +name = "roff" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "323c417e1d9665a65b263ec744ba09030cfb277e9daa0b018a4ab62e57bc8189" + [[package]] name = "rustc_version" version = "0.4.1" @@ -1340,6 +1368,19 @@ dependencies = [ "syn 3.0.3", ] +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + [[package]] name = "serde_spanned" version = "1.1.1" @@ -1905,3 +1946,9 @@ name = "wit-bindgen" version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index 5a5aee0..1a78714 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ratfetch" -version = "0.1.0" +version = "0.2.0" edition = "2021" # Set by ratatui 0.30, which is the highest MSRV in the dependency tree. rust-version = "1.88" @@ -17,11 +17,14 @@ include = ["src/**", "assets/**", "build.rs", "README.md", "LICENSE"] [dependencies] clap = { version = "4.6", features = ["derive"] } +clap_complete = "4.6" +clap_mangen = "0.2" crossterm = "0.29" dirs = "6.0" libc = "0.2" ratatui = "0.30" serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" toml = "1.1" [build-dependencies] diff --git a/README.md b/README.md index 34ef9cf..5defef3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ process table, filesystems and interfaces, all refreshing while you watch. ## What it does - **Live, not a snapshot.** Everything re-reads on a configurable interval. -- **526 logos**, the full set vendored from fastfetch, with their original +- **527 logos**, the full set vendored from fastfetch, with their original colour palettes. Auto-detected from `/etc/os-release`, or pick your own. - **Four tabs** — overview, processes, filesystems, interfaces. - **13 built-in themes**, plus per-role colour overrides. The default is @@ -75,6 +75,11 @@ ratfetch --once # one frame, like a classic fetch tool ratfetch --logo nixos # override the detected logo ratfetch --theme gruvbox-dark ratfetch --interval 250 # four samples a second +ratfetch --format json # one machine-readable snapshot +ratfetch --format plain # clean line-oriented output +ratfetch --diagnose # explain unavailable collectors +ratfetch --generate-completion fish +ratfetch --generate-man ratfetch.1 ratfetch --list-logos | fzf # browse what is bundled ``` @@ -90,9 +95,17 @@ ratfetch --list-logos | fzf # browse what is bundled | `c` | per-core CPU meters | | `space` | freeze / resume | | `r` | reload the config | +| `/` / `ctrl+u` | filter / clear the process list | +| `enter` / `t` | process details / tree view | +| `x` | confirm and send SIGTERM to the selected process | +| `i` / `e` | full system information / error history | All of them are rebindable. +The process table keeps a visible selection and scrollbar. Mouse clicks switch +tabs, and short split panes automatically prioritize information and meters +over decorative art and graphs. + ## Configuration ```sh diff --git a/assets/config.template.toml b/assets/config.template.toml index a052e79..a8526f4 100644 --- a/assets/config.template.toml +++ b/assets/config.template.toml @@ -34,7 +34,7 @@ watch_config = true [logo] # "auto" detects the distro. Otherwise a logo name ("arch", "nixos", "debian"), # "none", or "file:/path/to/your/art.txt". Run `ratfetch --list-logos` to see -# all 526 of them. +# all 527 of them. source = "auto" # Prefer the compact variant when the logo ships one. small = false @@ -119,7 +119,8 @@ colors = 3 # Rows of the info table, in order. Available rows: # title, separator, blank, os, host, kernel, uptime, packages, shell, # terminal, de, wm, resolution, cpu, cpu_temp, gpu, memory, swap, disk, -# local_ip, battery, load_avg, processes, users, locale, date_time, colors +# local_ip, local_ipv6, battery, load_avg, processes, users, locale, date_time, +# colors items = [ "title", "separator", @@ -154,7 +155,7 @@ bold_title = true hide_empty = true [meters] -# Live bars. Available: cpu, memory, swap, disk, battery, load. +# Live bars. Available: cpu, memory, swap, disk, battery, load, gpu. items = ["cpu", "memory", "swap", "disk"] # bar, line, blocks, or dots. style = "bar" @@ -169,7 +170,7 @@ label_width = 8 per_core = false [graphs] -# Time series. Available: cpu, memory, swap, network, disk, load. +# Time series. Available: cpu, memory, swap, network, disk, disk_io, load, gpu. items = ["cpu", "memory", "network"] # sparkline, braille, or bars. style = "sparkline" @@ -229,3 +230,10 @@ scroll_up = ["up", "k"] sort_next = ["s"] toggle_per_core = ["c"] freeze = ["space"] +info_details = ["i"] +errors = ["e"] +search_processes = ["/"] +clear_process_filter = ["ctrl+u"] +process_details = ["enter"] +process_tree = ["t"] +signal_process = ["x"] diff --git a/install.sh b/install.sh index 99a6239..d7a39c4 100755 --- a/install.sh +++ b/install.sh @@ -68,6 +68,7 @@ fi need tar need mktemp +need sha256sum # --- which version ---------------------------------------------------------- @@ -95,16 +96,13 @@ trap 'rm -rf "$tmp"' EXIT INT TERM fetch_to "$base/${name}.tar.gz" "$tmp/${name}.tar.gz" \ || die "no build published for ${target} in ${VERSION}." -if fetch_to "$base/SHA256SUMS" "$tmp/SHA256SUMS" 2>/dev/null; then - expected=$(grep " ${name}.tar.gz\$" "$tmp/SHA256SUMS" | cut -d' ' -f1 || true) - if [ -n "$expected" ] && command -v sha256sum >/dev/null 2>&1; then - actual=$(sha256sum "$tmp/${name}.tar.gz" | cut -d' ' -f1) - [ "$expected" = "$actual" ] || die "checksum mismatch for ${name}.tar.gz — refusing to install." - ok "checksum verified" - else - say "skipping checksum verification (no entry or no sha256sum)" - fi -fi +fetch_to "$base/SHA256SUMS" "$tmp/SHA256SUMS" 2>/dev/null \ + || die "could not download SHA256SUMS — refusing an unverified install." +expected=$(grep " ${name}.tar.gz\$" "$tmp/SHA256SUMS" | cut -d' ' -f1 || true) +[ -n "$expected" ] || die "SHA256SUMS has no entry for ${name}.tar.gz." +actual=$(sha256sum "$tmp/${name}.tar.gz" | cut -d' ' -f1) +[ "$expected" = "$actual" ] || die "checksum mismatch for ${name}.tar.gz — refusing to install." +ok "checksum verified" tar -xzf "$tmp/${name}.tar.gz" -C "$tmp" [ -x "$tmp/$name/ratfetch" ] || die "the archive did not contain a ratfetch binary." diff --git a/site/index.html b/site/index.html index f8a5626..9a91e4c 100644 --- a/site/index.html +++ b/site/index.html @@ -80,7 +80,7 @@

ratfetch

What it does