3 releases
new 0.1.2 | Apr 28, 2025 |
---|---|
0.1.1 | Apr 26, 2025 |
0.1.0 | Apr 26, 2025 |
#677 in Command line utilities
113 downloads per month
12KB
87 lines
Aspect Ratio
Table of Contents
About
Aspect Ratio is a simple CLI tool written in Rust for quickly reducing width and height values to their simplest aspect ratio form. It supports multiple input formats and is designed for fast, efficient use in the terminal.
Getting Started
Follow these instructions to build and use the project on your local machine.
Prerequisites
- Rust (version 1.82.0 or later)
- Cargo (comes with Rust)
Building
Clone the repository and build the project:
git clone https://github.com/anhkhoakz/some-rust-scripts/
cd aspect-ratio
cargo build --release
Installing
To install the binary system-wide (requires sudo):
sudo make install
You can also install it from crates.io:
cargo install aspect-ratio-cli
Uninstalling
To remove the installed binary:
make uninstall
Or, if installed via Cargo:
cargo uninstall aspect-ratio-cli
Usage
You can run the tool with:
./target/release/aspect-ratio-cli <width> <height>
./target/release/aspect-ratio-cli <width>x<height>
./target/release/aspect-ratio-cli <width>:<height>
Or, if installed system-wide or via Cargo, you can run it directly:
aspect-ratio-cli <width> <height>
aspect-ratio-cli <width>x<height>
aspect-ratio-cli <width>:<height>
Examples
$ aspect-ratio-cli 1920 1080
16:9
$ aspect-ratio-cli 1280x720
16:9
$ aspect-ratio-cli 1024:768
4:3
If you provide invalid input, the tool will print an error and usage instructions.
License
This project is licensed under the GNU General Public License version 2. See the LICENSE file for details.
Dependencies
~1–1.6MB
~31K SLoC