Expand description
§convertx
A simple unit-conversion CLI supporting many unit types such as
- bytes
- time
- length
- temperature
- mass
- data rate,
- area, volume,
- speed
- pressure
- more
§Installation
Simply put the following in your Cargo.toml.
[dependencies]
convertx = "0.1.0"
Or use cargo add convertx
§Usage
convertx <SUBCOMMAND> [OPTIONS]
§Examples
Convert 1024 bytes to megabytes:
convertx bytes 1024 --megabytes
# Output: 1024 bytes = 0.00 MB
convertx bytes 1024 -m
# Output: 1024 bytes = 0.00 MB
Convert 3600 seconds to human-readable time:
convertx time 3600 --human-readable
# Output: 3600 seconds = 1h 0m 0s
convertx time 3600 -h
# Output: 3600 seconds = 1h 0m 0s
Convert 1 kilometer to feet:
convertx length 1 --from kilometers --to feet
# Output: 1.0000 kilometers = 3280.8400 feet
convertx length 10 -f kilometers -t feet
# Output: 10.0000 kilometers = 32800.8400 feet
Convert 100 Fahrenheit to Celsius:
convertx temperature 100 --from F --to C
# Output: 100.00°F = 37.78°C
Run with --help
to see all supported subcommands and options.
Macros§
- Macro for quickly defining enums with string variants and utility implementations.
Enums§
- Area
Unit 🔒 - Cli 🔒Command-line interface definition for convertx. Use
convertx <SUBCOMMAND> [OPTIONS]
for usage. - Mass
Unit 🔒 - Temp
Unit 🔒
Constants§
- Constant: Number of bits per second in one megabit per second.
- Constant: Number of feet in a meter.
- Constant: Number of inches in a meter.
- Constant: Zero-offset for Kelvin scale.
- KG_
IN_ 🔒LB Constant: Number of kilograms in one pound. - OZ_
IN_ 🔒KG Constant: Number of ounces in one kilogram.
Functions§
- Convert a number of bytes to a human-readable string.
- Convert bytes to megabytes.
- Convert between area units.
- Convert between data rate units (bps, Mbps).
- Convert between length units.
- Convert between mass units.
- Convert between pressure units.
- Convert between speed units.
- Convert between temperature units (Celsius, Fahrenheit, Kelvin).
- Convert between volume units.
- main 🔒Entry point for the CLI application.
- Convert seconds to a human-readable string (e.g., days, hours, minutes, seconds).