radfish 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2534886d2e0c3a44557ba45fd676bc906ae16264722482edb048673196e0ae6
4
- data.tar.gz: 89e181a9cb4ca8522a0cac8207df8179fac3498bd8e3d6a1fc43d07a76c33cfc
3
+ metadata.gz: 2f57d68f93828e6ae9d3721da829aa6c667660ce2995e5f133bb30b9575db4e0
4
+ data.tar.gz: 443f6020c0c9d017248044db6e4073c2144ef03c0856e2dc646a483dde1664e2
5
5
  SHA512:
6
- metadata.gz: 8c11bd5b855ae57164589e4e251c0537b31a38f13a29fde244ca20a232bf03067541e6b299c19153dec2676cdcb35b1977a8b68150f7d093f6799b159b2d9aa8
7
- data.tar.gz: ee6d258fa7c775222c0b3584c68489ae7dc0868081cfcb87dfa43b01afa1d97b4b17a2776cb4b6ae023581cab52e800a8bbd49449cef6616c9e1aca6f63e270a
6
+ metadata.gz: 1c7beb6bb2104a5955af53c23fcb3d61443996301b60b7b215fdbf3fd71a540e3aca19d43f8dc81fc8d8cb5af4ecf21edbfcdd580797707bfa1b748377bdba55
7
+ data.tar.gz: 5d352457420a2bc1c71bc6026eb36f847eda5929a611058acad25e43e07199bab22e699f8653c3e2e974505c9cea5ae786a555aaef7e99c7981c293dfcd996ea
data/lib/radfish/cli.rb CHANGED
@@ -74,6 +74,13 @@ module Radfish
74
74
  when 'status', 'state'
75
75
  status = client.power_status
76
76
  output_result({ power_status: status }, "Power Status: #{status}", status == 'On' ? :green : :yellow)
77
+ when 'consumption', 'usage', 'watts'
78
+ begin
79
+ watts = client.power_consumption_watts
80
+ output_result({ power_consumption_watts: watts }, "Power Consumption: #{watts}W", :green)
81
+ rescue NotImplementedError
82
+ error "Power consumption not supported for this vendor"
83
+ end
77
84
  when 'on'
78
85
  result = client.power_on
79
86
  output_result({ success: result }, result ? "System powered on" : "Failed to power on")
@@ -96,7 +103,7 @@ module Radfish
96
103
  output_result({ success: result }, result ? "Power cycle initiated" : "Failed to power cycle")
97
104
  else
98
105
  error "Unknown power command: #{subcommand}"
99
- puts "Available: status, on, off, force-off, restart, force-restart, cycle"
106
+ puts "Available: status, on, off, force-off, restart, force-restart, cycle, consumption"
100
107
  puts "Use --force flag with 'off' or 'restart' to skip graceful shutdown"
101
108
  end
102
109
  end
@@ -34,6 +34,10 @@ module Radfish
34
34
  def power_consumption
35
35
  raise NotImplementedError, "Adapter must implement #power_consumption"
36
36
  end
37
+
38
+ def power_consumption_watts
39
+ raise NotImplementedError, "Adapter must implement #power_consumption_watts"
40
+ end
37
41
  end
38
42
  end
39
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Radfish
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel