Command line access to ausnom.com, a webservice exposing AU and NZ nutritional data as provided by foodstandards.gov.au.
~ $ nom Tofu 1: Ice Confection, Tofu-Based, Vanilla Flavour 2: Tofu (Soy Bean Curd), Burger Pattie, As Purchased 3: Tofu (Soy Bean Curd), Firm, As Purchased 4: Tofu (Soy Bean Curd), Silken Or Soft, As Purchased 5: Tofu (Soy Bean Curd), Smoked, As Purchased ~ $ nom Tofu 5 Tofu (Soy Bean Curd), Smoked, As Purchased Energy 751.0KJ Protein 17.3G ~ $ nom Tofu 3 Tofu (Soy Bean Curd), Firm, As Purchased Energy 530.0KJ Protein 12.0G
You can customize the nutrients shown by creating ~/.nom to look like this:
base: ausnom.com nutrients: - Energy - Protein
gem install nom
Tested on 1.8.7 and 1.9.2.
git clone git://github.com/xaviershay/nom.git bundle install rake # Run the specs
The specs include integration tests that run against the live website, so you will need internet access for them to pass. Alternatively, you can set up an ausnom server on your machine and develop against that (github.com/xaviershay/ausnom).
Command line parsing is currently ad-hoc, I would be open to using a proper library to do this (optparse?)
Spec'd, I use it, need to clean up the below TODOs before 1.0 release.
Display help text when no arguments provided
Allow calories to be displayed rather than energy