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
Instance Method Summary collapse
Instance Method Details
#disconnect(provider) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/legion/cli/connect_command.rb', line 46 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
25 26 27 |
# File 'lib/legion/cli/connect_command.rb', line 25 def github say 'GitHub connection not yet implemented.', :yellow end |
#microsoft ⇒ Object
18 19 20 21 |
# File 'lib/legion/cli/connect_command.rb', line 18 def microsoft say 'Delegating to Teams OAuth2 browser auth...', :blue Legion::CLI::Auth.start(['teams'] + ARGV.select { |a| a.start_with?('--') }) end |
#status ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/legion/cli/connect_command.rb', line 30 def status require 'legion/auth/token_manager' PROVIDERS.each do |provider| manager = Legion::Auth::TokenManager.new(provider: provider.to_sym) if manager.token_valid? say " #{provider}: connected", :green elsif manager.revoked? say " #{provider}: revoked", :red else say " #{provider}: not connected", :yellow end end end |