Parent

Methods

Launchy::CommandLine

Public Instance Methods

parser() click to toggle source
    # File lib/launchy/command_line.rb, line 6
 6:     def parser
 7:       @parser ||= OptionParser.new do |op|
 8:         op.banner = "Usage: launchy [options] url"
 9:         op.separator ""
10:         op.on("-d", "--debug", "Force debug, output lots of information.",
11:                                "This sets the LAUNCHY_DEBUG environment variable to 'true'.") do |d|
12:           ENV["LAUNCHY_DEBUG"] = 'true'
13:         end
14: 
15:         op.on("-h", "--help", "Print this message") do |h|
16:           puts op.to_s
17:           exit 0
18:         end
19: 
20:         op.on("-v", "--version", "Output the version of Launchy") do |v|
21:           puts "Launchy version #{Launchy::VERSION}"
22:           exit 0
23:         end
24: 
25:         op.on("-o", "--host-os HOST_OS","Force the behavior of a particular host os.",
26:                                     "This sets the LAUNCHY_HOST_OS environment variable.") do |os|
27:           ENV["LAUNCHY_HOST_OS"] = os
28:         end
29: 
30:         op.on("-b", "--browser BROWSER", "Force launchy to use a particular browser.",
31:                                    "This sets the LAUNCHY_BROWSER environment variable.") do |browser|
32:           ENV["LAUNCHY_BROWSER"] = browser
33:         end
34:       end
35:     end
run(argv = ARGV) click to toggle source
    # File lib/launchy/command_line.rb, line 37
37:     def run(argv = ARGV)
38:       begin
39:         parser.parse!(argv)
40:         Launchy.open(*argv)
41:       rescue ::OptionParser::ParseError => pe
42:         $stderr.puts "#{parser.programn_name}: #{pe}"
43:         $stderr.puts "Try `#{parser.program_name} --help' for more information."
44:         exit 1
45:       end
46:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.