mirror of
https://github.com/lotabout/skim.git
synced 2026-09-10 07:16:23 -04:00
* Shrink binary: trim image decoders and swap color-eyre for eyre Two dependency changes that cut the default `sk` binary from 13.6 MiB to 8.55 MiB (-5.06 MiB, -37%) with no loss of core functionality: - image: build the `image` crate with only the common decoders (png, jpeg, gif, webp) instead of its full default format set, and drop ratatui-image's `image-defaults`. This removes AVIF encoding (ravif, avif-serialize), OpenEXR (exr), TIFF, QOI and other decoders that are irrelevant to terminal image previews. Previewing those formats now falls back to the normal command preview. - error handling: replace color-eyre with plain eyre. color-eyre only provided colored panic/error backtraces; skim used none of its Section/Help extension APIs. This drops the backtrace/gimli/addr2line/ color-spantrace stack. `color_eyre::install()` is no longer needed. Tests, benches and examples are migrated from color_eyre to eyre so the crate is fully removed from the dependency graph. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQtxeCS4gM7dumghqmNgST * chore: fmt * docs: ARCHITECTURE.md * chore(flake): add cargo-bloat --------- Co-authored-by: Claude <noreply@anthropic.com>
26 lines
564 B
Rust
26 lines
564 B
Rust
//! Demonstrates image previews using a literal image path.
|
|
//!
|
|
//! Run with:
|
|
//! `cargo run --example image`
|
|
|
|
use skim::options::ImageProtocol;
|
|
use skim::prelude::*;
|
|
|
|
fn main() -> eyre::Result<()> {
|
|
env_logger::init();
|
|
|
|
let options = SkimOptionsBuilder::default()
|
|
.preview("{}")
|
|
.preview_window("right:60%")
|
|
.image(ImageProtocol::Halfblocks)
|
|
.build()?;
|
|
|
|
let output = Skim::run_items(options, ["examples/Lenna.png"])?;
|
|
|
|
for item in &output.selected_items {
|
|
println!("{}", item.output());
|
|
}
|
|
|
|
Ok(())
|
|
}
|