Class: QEDoc::Command
- Inherits:
-
Object
- Object
- QEDoc::Command
- Defined in:
- lib/qedoc/command.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Command
constructor
A new instance of Command.
- #parser ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize ⇒ Command
Returns a new instance of Command.
19 20 21 |
# File 'lib/qedoc/command.rb', line 19 def initialize @options = {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/qedoc/command.rb', line 16 def @options end |
Class Method Details
.run ⇒ Object
11 12 13 |
# File 'lib/qedoc/command.rb', line 11 def self.run new.run end |
Instance Method Details
#parser ⇒ Object
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. = "Usage: qedoc [OPTIONS] <QEDFile1> [ <QEDFile2> ... ]" usage.on("-o", "--output [DIR]", "Output directory") do |dir| [:output]= dir end usage.on("-t", "--title [TITLE]", "Title of Document") do |title| [:title]= title end usage.on("--css [URI]", "Specify a URI for a CSS file add to HTML header.") do |uri| [:css] = uri end usage.on("--dryrun", "") do [:dryrun] = true end usage.on("-q", "--quiet", "") do [:quiet] = true end usage.on_tail("-h", "--help", "display this help message") do puts usage exit end end end |
#run ⇒ Object
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! [: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() doc.generate end |