Class: Legion::CLI::Gaia
- Inherits:
-
Thor
- Object
- Thor
- Legion::CLI::Gaia
- Defined in:
- lib/legion/cli/gaia_command.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
9 10 11 |
# File 'lib/legion/cli/gaia_command.rb', line 9 def self.exit_on_failure? true end |
Instance Method Details
#buffer ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/legion/cli/gaia_command.rb', line 64 def buffer out = formatter data = api_get('/api/gaia/buffer') if data.nil? show_not_running(out) return end if [:json] out.json(data) return end out.header('GAIA Sensory Buffer') out.detail({ 'Depth' => (data[:depth] || 0).to_s, 'Empty' => (data[:empty] || true).to_s, 'Max Size' => (data[:max_size] || 'unknown').to_s }) end |
#channels ⇒ Object
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 |
# File 'lib/legion/cli/gaia_command.rb', line 36 def channels out = formatter data = api_get('/api/gaia/channels') if data.nil? show_not_running(out) return end if [:json] out.json(data) return end channels_list = data[:channels] || [] out.header("GAIA Channels (#{channels_list.size})") if channels_list.empty? puts ' No channels registered.' else channels_list.each do |ch| status_str = ch[:started] ? 'active' : 'stopped' caps = ch[:capabilities]&.any? ? " [#{ch[:capabilities].join(', ')}]" : '' puts " #{ch[:id]} (#{ch[:type] || 'unknown'}) - #{status_str}#{caps}" end end end |
#sessions ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/legion/cli/gaia_command.rb', line 87 def sessions out = formatter data = api_get('/api/gaia/sessions') if data.nil? show_not_running(out) return end if [:json] out.json(data) return end out.header('GAIA Sessions') out.detail({ 'Active Sessions' => (data[:count] || 0).to_s, 'System Active' => (data[:active] || false).to_s }) end |
#status ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/legion/cli/gaia_command.rb', line 21 def status out = formatter data = api_get('/api/gaia/status') if data.nil? show_not_running(out) elsif [:json] out.json(data) else show_status(out, data) end end |