in files/gitlab-ctl-commands/lib/praefect.rb [52:95]
def self.parse_options!(args)
loop do
break if args.shift == 'praefect'
end
global = OptionParser.new do |opts|
opts.on('-h', '--help', 'Usage help') do
Kernel.puts USAGE
Kernel.exit 0
end
end
options = {}
commands = populate_commands(options)
global.order!(args)
command = args.shift
raise OptionParser::ParseError, "Praefect command is not specified." \
if command.nil? || command.empty?
raise OptionParser::ParseError, "Unknown Praefect command: #{command}" \
unless commands.key?(command)
commands[command].parse!(args)
if ['remove-repository', 'track-repository'].include?(command)
raise OptionParser::ParseError, "Option --virtual-storage-name must be specified." \
unless options.key?(:virtual_storage_name)
raise OptionParser::ParseError, "Option --repository-relative-path must be specified." \
unless options.key?(:repository_relative_path)
end
raise OptionParser::ParseError, "Option --input-path must be specified." \
if command == 'track-repositories' && !options.key?(:input_path)
options[:command] = command
options
end