Class: Legion::CLI::ConnectCommand
- Inherits:
-
Thor
- Object
- Thor
- Legion::CLI::ConnectCommand
- Defined in:
- lib/legion/cli/connect_command.rb
Constant Summary collapse
- PROVIDERS =
%w[microsoft github google].freeze
- STATE_COLORS =
{ 'connected' => :green, 'revoked' => :red, 'not connected' => :yellow }.freeze
Instance Method Summary collapse
Instance Method Details
#disconnect(provider) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/legion/cli/connect_command.rb', line 45 def disconnect(provider) unless PROVIDERS.include?(provider) say "Unknown provider: #{provider}. Valid: #{PROVIDERS.join(', ')}", :red return end say "Disconnected #{provider} account.", :green end |
#github ⇒ Object
30 31 32 |
# File 'lib/legion/cli/connect_command.rb', line 30 def github say 'GitHub connection not yet implemented.', :yellow end |
#microsoft ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/legion/cli/connect_command.rb', line 19 def microsoft say 'Delegating to Teams OAuth2 browser auth...', :blue forwarded = ['teams'] forwarded += ['--tenant_id', [:tenant_id]] if [:tenant_id] forwarded += ['--client_id', [:client_id]] if [:client_id] forwarded += ['--scopes', [:scope]] if [:scope] Legion::CLI::Auth.start(forwarded) end |
#status ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/legion/cli/connect_command.rb', line 35 def status require 'legion/auth/token_manager' PROVIDERS.each do |provider| state = provider_state(provider) say " #{provider}: #{state}", STATE_COLORS.fetch(state, :yellow) end end |