Class: Ace::Git::Secrets::Commands::RevokeCommand
- Inherits:
-
Object
- Object
- Ace::Git::Secrets::Commands::RevokeCommand
- Defined in:
- lib/ace/git/secrets/commands/revoke_command.rb
Overview
CLI command for revoking tokens via provider APIs
Class Method Summary collapse
-
.execute(options) ⇒ Integer
Execute revoke command.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options) ⇒ RevokeCommand
constructor
A new instance of RevokeCommand.
Constructor Details
#initialize(options) ⇒ RevokeCommand
Returns a new instance of RevokeCommand.
16 17 18 |
# File 'lib/ace/git/secrets/commands/revoke_command.rb', line 16 def initialize() @options = end |
Class Method Details
.execute(options) ⇒ Integer
Execute revoke command
12 13 14 |
# File 'lib/ace/git/secrets/commands/revoke_command.rb', line 12 def self.execute() new().execute end |
Instance Method Details
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ace/git/secrets/commands/revoke_command.rb', line 20 def execute tokens = load_tokens return 1 if tokens.nil? if tokens.empty? puts "No tokens found to revoke." puts "Run 'ace-git-secrets scan' first to detect tokens." return 0 end # Filter by service if specified services = @options[:service] ? [@options[:service]] : nil revoker = Molecules::TokenRevoker.new results = revoker.revoke_all(tokens, services: services) # Display results display_results(results) # Return code based on results if results.all?(&:success?) 0 elsif results.any?(&:success?) 1 # Partial success else 1 end rescue => e puts "Error: #{e.}" puts e.backtrace.first(5).join("\n") if ENV["DEBUG"] 2 end |