class TaskJuggler::Tj3Man

Public Class Methods

new() click to toggle source
Calls superclass method TaskJuggler::Tj3AppBase::new
# 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

Public Instance Methods

appMain(requestedKeywords) click to toggle source
# 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) click to toggle source
# File lib/taskjuggler/apps/Tj3Man.rb, line 37
    def processArguments(argv)
      super do
        @opts.banner.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