5 releases
0.2.0 | May 4, 2025 |
---|---|
0.1.5 | May 4, 2025 |
0.1.2 | Apr 28, 2025 |
#202 in Command line utilities
806 downloads per month
16KB
272 lines
aspect-ratio-cli
About
aspect-ratio-cli is a fast, simple CLI tool written in Rust for reducing width and height values to their simplest aspect ratio form. It supports multiple input formats and is designed for efficient use in the terminal.
Features
- Reduce width and height to the simplest aspect ratio (e.g., 1920x1080 → 16:9)
- Supports input as
<width> <height>
,<width>x<height>
, or<width>:<height>
- Convert aspect ratios to a target width or height
- Show decimal representation of aspect ratios
- Generate shell completions for popular shells
Getting Started
Prerequisites
Building
git clone https://github.com/anhkhoakz/some-rust-scripts.git
cd some-rust-scripts/aspect-ratio
just build
Installing
System-wide (optional, requires sudo):
just install
Or from crates.io:
cargo install aspect-ratio-cli
Uninstalling
just uninstall
# or, if installed via Cargo:
cargo uninstall aspect-ratio-cli
Usage
aspect-ratio-cli [COMMAND]
Available Commands
convert
: Convert an aspect ratio to a target width or height.info
: Show info about an aspect ratio.completions
: Generate shell completions for popular shells.calc
: Reduce an aspect ratio to its simplest form.-h, --help
: Print help for the tool or command.-V, --version
: Print the version of the tool.
Example
aspect-ratio-cli calc 1920 1080
If you provide invalid input, the tool will print an error and usage instructions.
Contributing
Contributions are welcome! Please open issues or pull requests on GitHub. See the root CONTRIBUTING.md
for guidelines.
License
This project is licensed under the GNU General Public License v2.0. See the LICENSE file for details.
Dependencies
~1.2–1.8MB
~33K SLoC