From f40a922af92675e317b999c3aa2423d689c0bca8 Mon Sep 17 00:00:00 2001 From: dtwilliamson Date: Mon, 6 May 2019 19:30:06 -0500 Subject: [PATCH 1/2] Allow setting of default temperature scale --- lib/iStats/command.rb | 7 ++++++- lib/iStats/version.rb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/iStats/command.rb b/lib/iStats/command.rb index 3645daf..6ab9432 100644 --- a/lib/iStats/command.rb +++ b/lib/iStats/command.rb @@ -88,7 +88,7 @@ def parse_options :display_graphs => true, :display_labels => true, :display_scale => true, - :temperature_scale => 'celcius', + :temperature_scale => ($config.params.dig('app_config', 'temperature_scale') || 'celcius').downcase } opt_parser = OptionParser.new do |opts| @@ -123,6 +123,10 @@ def parse_options opts.on('-f', '--fahrenheit', 'Display temperatures in fahrenheit') do options[:temperature_scale] = 'fahrenheit' end + + opts.on('-c', '--celcius', 'Display temperatures in celcius (default)') do + options[:temperature_scale] = 'celcius' + end end begin @@ -175,6 +179,7 @@ def help(error = nil) --no-scale Display just the stat value --value-only No graph, label, or scale -f, --fahrenheit Display temperatures in fahrenheit + -c, --celcius Display temperatures in celcius (default) for more help see: https://github.com/Chris911/iStats ".gsub(/^ {8}/, '') # strip the first eight spaces of every line diff --git a/lib/iStats/version.rb b/lib/iStats/version.rb index 434f1c9..37f647d 100644 --- a/lib/iStats/version.rb +++ b/lib/iStats/version.rb @@ -1,3 +1,3 @@ module IStats - VERSION = '1.6.1' + VERSION = '1.6.2' end From 37d5618abba944ffb9c636f25c9e396ab36c7a26 Mon Sep 17 00:00:00 2001 From: dtwilliamson Date: Mon, 6 May 2019 20:39:52 -0500 Subject: [PATCH 2/2] updated README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index d4d4457..b195d2a 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ If you are running an older version of OS X and the install fails you might want --no-scale Display just the stat value --value-only No graph, label, or scale -f, --fahrenheit Display temperatures in fahrenheit + -c, --celcius Display temperatures in celcius (default) for more help see: https://github.com/Chris911/iStats ``` @@ -65,6 +66,15 @@ iStats now supports extra sensors for advanced users. Here's how to enable that 2. Enable extra sensors by running `istats enable key` or `istats enable all` 3. Run `istats` or `istats extra` to see the extra sensors information. +The temperature scale can be configured persistently by adding a section to `~/.iStats/sensors.conf` like this: + +``` +[app_config] +temperature_scale = fahrenheit +``` + +The valid values are 'fahrenheit' and 'celcius' (which is the default) and can be overridden using the corresponding command line options. + ## Contributing 1. Fork it