Class: QEDoc::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/qedoc/command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommand

Returns a new instance of Command.



19
20
21
# File 'lib/qedoc/command.rb', line 19

def initialize
  @options = {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/qedoc/command.rb', line 16

def options
  @options
end

Class Method Details

.runObject



11
12
13
# File 'lib/qedoc/command.rb', line 11

def self.run
  new.run
end

Instance Method Details

#parserObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/qedoc/command.rb', line 24

def parser
  OptionParser.new do |usage|

    usage.banner = "Usage: qedoc [OPTIONS] <QEDFile1> [ <QEDFile2> ... ]"

    usage.on("-o", "--output [DIR]", "Output directory") do |dir|
      options[:output]= dir
    end

    usage.on("-t", "--title [TITLE]", "Title of Document") do |title|
      options[:title]= title
    end

    usage.on("--css [URI]", "Specify a URI for a CSS file add to HTML header.") do |uri|
      options[:css] = uri
    end

    usage.on("--dryrun", "") do
      options[:dryrun] = true
    end

    usage.on("-q", "--quiet", "") do
      options[:quiet] = true
    end

    usage.on_tail("-h", "--help", "display this help message") do
      puts usage
      exit
    end

  end
end

#runObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/qedoc/command.rb', line 58

def run
  parser.parse!

  options[:paths] = ARGV.dup

  #opts[:output] = cli.options[:file]
  #opts[:dryrun] = cli.options[:dryrun]
  #opts[:quiet]  = cli.options[:quiet]
  #opts[:css]    = cli.options[:css]
  #opts[:title]  = cli.options[:title]

  doc = QED::Document.new(options)

  doc.generate
end