Class: TaskJuggler::Tj3Man
- Inherits:
-
Tj3AppBase
- Object
- Tj3AppBase
- TaskJuggler::Tj3Man
- Defined in:
- lib/taskjuggler/apps/Tj3Man.rb
Instance Method Summary collapse
- #appMain(requestedKeywords) ⇒ Object
-
#initialize ⇒ Tj3Man
constructor
A new instance of Tj3Man.
- #processArguments(argv) ⇒ Object
Methods inherited from Tj3AppBase
Methods included from MessageHandler
#critical, #debug, #error, #fatal, #info, #warning
Constructor Details
#initialize ⇒ Tj3Man
Returns a new instance of Tj3Man.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/taskjuggler/apps/Tj3Man.rb', line 25 def initialize super @man = SyntaxReference.new @keywords = TernarySearchTree.new(@man.all) @manual = false @showHtml = false @browser = ENV['BROWSER'] || 'firefox' @directory = './' @mininumRubyVersion = '1.8.7' end |
Instance Method Details
#appMain(requestedKeywords) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/taskjuggler/apps/Tj3Man.rb', line 68 def appMain(requestedKeywords) if @manual UserManual.new.generate(@directory) elsif requestedKeywords.empty? showManual else requestedKeywords.each do |keyword| if (kws = @keywords[keyword, true]).nil? error('tj3man_no_matches', "No matches found for '#{keyword}'") elsif kws.length == 1 || kws.include?(keyword) showManual(keyword) else warning('tj3man_multi_match', "Multiple matches found for '#{keyword}':\n" + "#{kws.join(', ')}") end end end 0 end |
#processArguments(argv) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/taskjuggler/apps/Tj3Man.rb', line 37 def processArguments(argv) super do @opts..prepend(<<'EOT' This program can be used to generate the user manual in HTML format or to get a textual help for individual keywords. EOT ) @opts.on('-d', '--dir <directory>', String, format('directory to put the manual')) do |dir| @directory = dir end @opts.on('--html', format('Show the user manual in your local web browser. ' + 'By default, Firefox is used or the browser specified ' + 'with the $BROWSER environment variable.')) do @showHtml = true end @opts.on('--browser <command>', String, format('Specify the command to start your web browser. ' + 'The default is \'firefox\'.')) do |browser| @browser = browser end @opts.on('-m', '--manual', format('Generate the user manual into the current directory ' + 'or the directory specified with the -d option.')) do @manual = true end end end |