Parent

Launchy::Cli

Attributes

options[R]

Public Class Methods

new() click to toggle source
   # File lib/launchy/cli.rb, line 7
7:     def initialize
8:       @options = {}
9:     end

Public Instance Methods

good_run( argv, env ) click to toggle source
    # File lib/launchy/cli.rb, line 70
70:     def good_run( argv, env )
71:       if parse( argv, env ) then
72:         Launchy.open( argv.shift, options )
73:         return true
74:       else
75:         return false
76:       end
77:     end
parse( argv, env ) click to toggle source
    # File lib/launchy/cli.rb, line 59
59:     def parse( argv, env )
60:       begin
61:         parser.parse!( argv )
62:         return true
63:       rescue ::OptionParser::ParseError => pe
64:         $stderr.puts "#{parser.program_name}: #{pe}"
65:         $stderr.puts "Try `#{parser.program_name} --help for more information."
66:         return false
67:       end
68:     end
parser() click to toggle source
    # File lib/launchy/cli.rb, line 11
11:     def parser
12:       @parser ||= OptionParser.new do |op|
13:         op.banner = "Usage: launchy [options] thing-to-launch"
14: 
15:         op.separator ""
16:         op.separator "Launch Options:"
17: 
18:         op.on( "-a", "--application APPLICATION", 
19:                "Explicitly specify the application class to use in the launch") do |app|
20:           @options[:application] = app
21:         end
22: 
23:         op.on( "-d", "--debug", 
24:                "Force debug. Output lots of information.") do |d|
25:           @options[:debug] = 'true'
26:         end
27: 
28:         op.on( "-e", "--engine RUBY_ENGINE",
29:                "Force launchy to behave as if it was on a particular ruby engine.") do |e|
30:           @options[:ruby_engine] = e
31:         end
32: 
33:         op.on( "-n", "--dry-run", "Don't launchy, print the command to be executed on stdout" ) do |x|
34:           @options[:dry_run] = true
35:         end
36: 
37:         op.on( "-o", "--host-os HOST_OS", 
38:                "Force launchy to behave as if it was on a particular host os.") do |os|
39:           @options[:host_os] = os
40:         end
41: 
42: 
43:         op.separator ""
44:         op.separator "Standard Options:"
45: 
46:         op.on( "-h", "--help", "Print this message.") do |h|
47:           $stdout.puts op.to_s
48:           exit 0
49:         end
50: 
51:         op.on( "-v", "--version", "Output the version of Launchy") do |v|
52:           $stdout.puts "Launchy version #{Launchy::VERSION}"
53:           exit 0
54:         end
55: 
56:       end
57:     end
run( argv = ARGV, env = ENV ) click to toggle source
    # File lib/launchy/cli.rb, line 79
79:     def run( argv = ARGV, env = ENV )
80:       exit 1 unless good_run( argv, env )
81:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.