HalosGhost / shaman

A small, native C library and utility to fetch weather
GNU General Public License v2.0
49 stars 4 forks source link

Option to only print integers #20

Open jasonwryan opened 10 years ago

jasonwryan commented 10 years ago

A nice feature, when using shaman to print to a status bar, would be to just print the integer, e.g., rather than 10.75°C just print 10°C.

This would make most sense as a switch passed to all numeric values for the return of any given command, for example:

shaman -l Wellington,NZ -m -f -d "%t°C"
10°C

shaman -l Wellington,NZ -m -f  -d "Currently %t°C. %c with %wkm/h winds from %X."
Currently 10°C with 8km/h winds from SE

as opposed to:

Currently 10.75°C with 8.65km/h winds from SE
HalosGhost commented 10 years ago

All right, I will look into this. We are getting dangerously close to the point where using function parameters for these options is going to be silly (read: way too many function parameters). As a result, I may have to look into adopting a curl_easy_setopt() style.

That is, rather than calling owm_easy() with an overwhelming number of arguments, developers (and shaman) would call something like owm_easy_init() which creates a struct with various options (that can be modified with owm_easy_setopt()), and then you would pass the struct to owm_easy().

This is actually a great idea (since it means adding more options is much more sustainable), but it will require a fair bit of restructuring; and, what you actually want with this feature request (an option to print all numeric values as integers) won't really be doable without such a restructuring.

Consider it on the to-do list. Requires #21 for implementation.

jasonwryan commented 10 years ago

Thanks HG: much appreciated.