1.9 KiB
1.9 KiB
Copilot Instructions for o8_pics_size
Build, test, and lint commands
- Build:
cargo build - Run app:
cargo run - Run all tests:
cargo test - Run a single test:
cargo test <test_name> - Formatting check:
cargo fmt --check - Lint (if available in your toolchain):
cargo clippy -- -D warnings
High-level architecture
The application is a single-binary Rust CLI (src/main.rs) built as a staged pipeline:
- Pick an input Excel file (
.xls/.xlsx) viarfd::FileDialog. - Read workbook/sheet data with
calamine. - Use terminal UI selectors (
dialoguer::Select) to choose:- sheet
CikkszámcolumnUrlcolumnimg_sequencecolumn
- Build input rows from sheet data (header row is row 0, data starts from row 1).
- Download images from URLs using blocking
reqwest. - Decode image bytes with
imageto extract dimensions; compute size from downloaded byte length. - Export results to a new workbook with
rust_xlsxwriter, saved asresult_[uuid].xlsxnext to the input file.
Core helper responsibilities are split into functions in main.rs:
- selection helpers:
prompt_sheet_selection,prompt_column_selection - sheet parsing helpers:
extract_headers,collect_input_rows,cell_string - image metadata fetch:
fetch_image_metadata - output generation:
build_output_path,write_results_excel
Key conventions in this repository
- Fail-fast error handling: most failures print a clear
eprintln!message and exit with status 1. - Column naming is contract-like: output headers are currently written as:
CikkszámSqeuence(keep this spelling unless intentionally changed)UrlWidth (px)Height (px)Size (KB)
- Interactive flow is TUI-driven: keep sheet/column selection cursor-based (
dialoguer::Select), not numeric text prompts. - Output path pattern is fixed: write result files as
result_[uuid].xlsxin the same directory as the source workbook.