A simple and efficient unit conversion command line tool written in C
.gitignore | ||
LICENSE | ||
Makefile | ||
README.md | ||
unicon.c |
unicon
Table of Contents
Introduction
unicon is a command-line unit conversion tool that allows you to easily convert values between various units such as temperature, length, time, mass, and digital storage. This tool is designed to be user-friendly and flexible, allowing you to convert units with precision.
Features
- Convert between a wide range of unit types including temperature, length, time, mass, and digital storage.
- Easily specify the number of decimal places for rounding the result.
Building
This tool is provided as source code and can be built using make
. By just
typing make in the terminal within the code's directory:
make
You should now have an executable named unicon
. You can copy it to a location
in your PATH for easy access.
Usage
The general usage format for the unicon tool is as follows:
unicon [OPTIONS] VALUE from <UNIT> to <UNIT>
OPTIONS
: Optional command-line options (see Options).VALUE
: The numeric value you want to convert.from
: Keyword to specify the source unit.<UNIT>
: The source unit you want to convert from.to
: Keyword to specify the target unit.<UNIT>
: The target unit you want to convert to.
Options
-r, --round=PLACES
: Round the result to the specified number of decimal places.-h, --help
: Display the help message and exit.-v, --version
: Display version information and exit.
Examples
-
Convert 100 degrees Celsius to Fahrenheit, rounding to 2 decimal places:
unicon -r 2 100 from celsius to fahrenheit
-
Convert 5 kilometers to miles, rounding to 3 decimal places:
unicon -r 3 5 from kilometers to miles
-
Display the help message:
unicon -h
-
Display version:
unicon -v