Class: Jenkins2::CLI::ListCredentials
Instance Attribute Summary
#errors, #options
Class Method Summary
collapse
Instance Method Summary
collapse
#call, class_to_command, #initialize, #parse, subcommands
Constructor Details
This class inherits a constructor from Jenkins2::CLI
Class Method Details
.description ⇒ Object
155
156
157
|
# File 'lib/jenkins2/cli/credentials.rb', line 155
def self.description
'List credentials in a specific store.'
end
|
Instance Method Details
#add_options ⇒ Object
159
160
161
162
163
164
|
# File 'lib/jenkins2/cli/credentials.rb', line 159
def add_options
parser.separator 'Mandatory arguments:'
parser.on '--store STORE', 'Store id. (e.g. "system")' do |s|
options[:store] = s
end
end
|
#mandatory_arguments ⇒ Object
166
167
168
|
# File 'lib/jenkins2/cli/credentials.rb', line 166
def mandatory_arguments
super + [:store]
end
|
#run ⇒ Object
170
171
172
173
174
175
176
177
|
# File 'lib/jenkins2/cli/credentials.rb', line 170
def run
jc.credentials.store(options[:store], depth: 2).domains.to_h.collect do |_, v|
"Domain: #{v.displayName}\n" +
v.credentials.collect do |crd|
"#{crd.id} - #{crd.displayName}"
end.join("\n")
end.join("\n")
end
|