summaryrefslogtreecommitdiff
path: root/README.md
blob: 6b980811ca4cf7f577d131d5a4d09d94bafc58ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
blaunits
========
(aka blaconvert v2)

This is a ruby script for converting between two units. It's a wrapper 
around GNU Units, with a simpler syntax designed for use in IRC. 

It was written as a replacement for 'blaconvert', which served the same
function, but used the now deprecated Google conversion API. Rather than
using a remote API, it uses the GNU units program on the local system.

It should work with any units in the GNU units database, including currencies.
There may be some unexpected behavious with capitalisation.

Currency conversion rates are updated with the 'units_cur' program. 
It is recommended to run this daily with a cron job.

Usage
-----

`ruby blaunits.rb [amount] from-units to-units`

e.g

`ruby blaunits.rb 10 cm inches`

The amount can also be ommited to get the basic conversion rate

e.g

`ruby blaunits.rb GBP USD`

For units made up of more than one word you'll need to separate them with "to" or "in"

e.g

`ruby blaunits.rb US pints to fluid ounces`


Installation
------------

Install GNU units on your system. You may also need to run `units_cur` to initialise currency rates

Linux
-----

Should be available in any Linux distro's package manager, probably as 'units'

OS X
----

OS X includes an older version of units which is incompatible with blaunits.
A compatible version of GNU units can be installed from homebrew, but the binary
will be named "gunits". 

Rename the reference on line 4 to `gunits`

Windows
-------
vov