Class: Jenkins2::CLI::UpdateCredentialsByXml

Inherits:
Jenkins2::CLI show all
Defined in:
lib/jenkins2/cli/credentials.rb

Instance Attribute Summary

Attributes inherited from Jenkins2::CLI

#errors, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Jenkins2::CLI

#call, class_to_command, #initialize, #parse, subcommands

Constructor Details

This class inherits a constructor from Jenkins2::CLI

Class Method Details

.descriptionObject



181
182
183
# File 'lib/jenkins2/cli/credentials.rb', line 181

def self.description
	'Update credentials by XML.'
end

Instance Method Details

#add_optionsObject



185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/jenkins2/cli/credentials.rb', line 185

def add_options
	parser.separator 'Mandatory arguments:'
	parser.on '--store STORE', 'Store id. (e.g. "system")' do |s|
		options[:store] = s
	end
	parser.on '--domain DOMAIN', 'Domain id. (e.g. "_")' do |d|
		options[:domain] = d
	end
	parser.on '--credential ID', 'Credential id.' do |c|
		options[:credential] = c
	end
end

#mandatory_argumentsObject



198
199
200
# File 'lib/jenkins2/cli/credentials.rb', line 198

def mandatory_arguments
	super + %i[store domain credential]
end

#runObject



202
203
204
205
# File 'lib/jenkins2/cli/credentials.rb', line 202

def run
	jc.credentials.store(options[:store]).domain(options[:domain]).
		credential(options[:credential]).update($stdin.read)
end