A simple Rust command-line tool for converting between a wide range of units in categories such as length, temperature, mass, data rate, area, volume, speed, pressure, bytes, time and more.
To install convertx you can do so via cargo
1. Install with Cargo:
cargo add convertxOr simply put the following in your Cargo.toml.
[dependencies]
convertx = "0.1.0"
2. Clone and build:
Alternatively you can build it from the github repo and optionally install it globally
git clone https://github.com/jcharistech/convertx.git
cd convertx
cargo build --releaseThe binary will be located in target/release/convertx.
3. (Optional) Install globally:
cargo install --path .- Length: meters, kilometers, feet, inches
- Temperature: Celsius, Fahrenheit, Kelvin
- Mass/Weight: kilograms, pounds, ounces
- Data Rate: bits per second (bps), megabits per second (mbps)
- Bytes: supports human-readable and MB conversion
- Time: seconds, human-readable duration
- Area: square meters, square feet, acres, hectares
- Volume: liters, milliliters, cubic meters, cubic inches, gallons
- Speed: meters per second, kilometers per hour, miles per hour, knots
- Pressure: pascal, bar, atm, psi
- Easy to extend: add your own units and categories with minimal code changes
- Helpful CLI: shows usage and supported units on
--help
convertx [OPTIONS]Get help for any subcommand:
convertx --help| Subcommand | Description | Example |
|---|---|---|
| bytes | Convert byte values | convertx bytes 1048576 --megabytes |
| time | Convert seconds to human time | convertx time 4000 --human-readable |
| length | Convert length units | convertx length 2 --from meters --to feet |
| temperature | Convert temperature units | convertx temperature 100 --from c --to f |
| mass | Convert mass/weight units | convertx mass 2.5 --from kg --to lb |
| datarate | Convert data rate units | convertx datarate 10 --from mbps --to bps |
| area | Convert area units | convertx area 1000 --from sqm --to acres |
| volume | Convert volume units | convertx volume 2 --from gallons --to liters |
| speed | Convert speed units | convertx speed 60 --from mph --to kph |
| pressure | Convert pressure units | convertx pressure 1 --from atm --to psi |
Bytes:
convertx bytes 1048576 --megabytes
convertx bytes 1048576 --human-readableTime:
convertx time 4000 --human-readableLength:
convertx length 10 --from kilometers --to meters
convertx length 2 --from feet --to inchesTemperature:
convertx temperature 32 --from f --to c
convertx temperature 300 --from k --to fMass:
convertx mass 100 --from lb --to kg
convertx mass 500 --from oz --to lbData Rate:
convertx datarate 12345678 --from bps --to mbps
convertx datarate 15 --from mbps --to bpsArea:
convertx area 4046.86 --from sqm --to acres
convertx area 2 --from hectares --to sqftVolume:
convertx volume 3.5 --from gallons --to liters
convertx volume 2 --from cubic_meters --to gallonsSpeed:
convertx speed 60 --from mph --to kph
convertx speed 25 --from mps --to knotsPressure:
convertx pressure 2 --from bar --to psi
convertx pressure 101325 --from pa --to atm- Add new units by adding an enum variant, conversion function, and CLI case!
- PRs and improvements very welcome.
Jesus Saves @JCharisTech
Enjoy lightning-fast, accurate unit conversions from your terminal!