lib/mediawiki-hana/application.rb
# Parse arguments from the command line to set up the application
Parse arguments from the command line to set up the application
Parse arguments from the command line to set up the application
def parse_options(argv)
			@params = {}
			opts = OptionParser.new
			opts.banner = "Usage: QUERY [options]"
			opts.separator ""
			opts.separator "Specific options:"
			enforce_mutually_exclusive_rendering_modes(argv)
			opts.on("--text", "Render to a text file") { @params[:render_mode] = :text }
			opts.on("--json", "Render to json") { @params[:render_mode] = :json }
			opts.on("--csv", "Render to csv") {@params[:render_mode] = :csv }
			opts.on("-o", "--output [FILENAME]", "Output to a file") { |f| @params[:output_file] = f }
			opts.on("-i", "--input [FILENAME]", "Source file for search queries") { |f| @params[:input_file] = f}
			@params[:data_to_render] = []
			opts.on("-s", "Show search term") { @params[:data_to_render] << :search_term}
			opts.on("-t", "Show title") { @params[:data_to_render] << :title}
			opts.on("-d", "Show short description") { @params[:data_to_render] << :summary}
			opts.on("-f", "Show full text") { @params[:data_to_render] << :full_text}
			opts.on_tail("-h", "--help", "Show this message") do
				puts opts
				exit
			end
			@search_string = opts.parse(argv)[0]
			if @params[:input_file]
				process_input_file
			end
		end
def parse_options ( argv ) @params = { } opts = OptionParser . new opts . banner = "Usage: QUERY [options]" opts . separator "" opts . separator "Specific options:" enforce_mutually_exclusive_rendering_modes ( argv ) opts . on ( "--text" , "Render to a text file" ) { @params [ :render_mode ] = :text } opts . on ( "--json" , "Render to json" ) { @params [ :render_mode ] = :json } opts . on ( "--csv" , "Render to csv" ) { @params [ :render_mode ] = :csv } opts . on ( "-o" , "--output [FILENAME]" , "Output to a file" ) { | f | @params [ :output_file ] = f } opts . on ( "-i" , "--input [FILENAME]" , "Source file for search queries" ) { | f | @params [ :input_file ] = f } @params [ :data_to_render ] = [ ] opts . on ( "-s" , "Show search term" ) { @params [ :data_to_render ] << :search_term } opts . on ( "-t" , "Show title" ) { @params [ :data_to_render ] << :title } opts . on ( "-d" , "Show short description" ) { @params [ :data_to_render ] << :summary } opts . on ( "-f" , "Show full text" ) { @params [ :data_to_render ] << :full_text } opts . on_tail ( "-h" , "--help" , "Show this message" ) do puts opts exit end @search_string = opts . parse ( argv ) [ 0 ] if @params [ :input_file ] process_input_file end end
Parse arguments from the command line to set up the application
Parse arguments from the command line to set up the application
argv
<not_specific>