Class: Abt::Providers::Devops::Commands::Clear

Inherits:
BaseCommand show all
Defined in:
lib/abt/providers/devops/commands/clear.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #path

Attributes inherited from BaseCommand

#ari, #cli, #flags

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from Abt::Providers::Devops::BaseCommand

Class Method Details

.descriptionObject



12
13
14
# File 'lib/abt/providers/devops/commands/clear.rb', line 12

def self.description
  "Clear DevOps configuration"
end

.flagsObject



16
17
18
19
20
21
22
# File 'lib/abt/providers/devops/commands/clear.rb', line 16

def self.flags
  [
    ["-g", "--global",
     "Clear global instead of local DevOp configuration (credentials etc.)"],
    ["-a", "--all", "Clear all DevOp configuration"]
  ]
end

.usageObject



8
9
10
# File 'lib/abt/providers/devops/commands/clear.rb', line 8

def self.usage
  "abt clear devops"
end

Instance Method Details

#performObject



24
25
26
27
28
29
30
31
# File 'lib/abt/providers/devops/commands/clear.rb', line 24

def perform
  abort("Flags --global and --all cannot be used together") if flags[:global] && flags[:all]

  config.clear_local unless flags[:global]
  config.clear_global if flags[:global] || flags[:all]

  warn("Configuration cleared")
end