Class: Latex2hiki::Command

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

Overview

Your code goes hereā€¦

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv = []) ⇒ Command

Returns a new instance of Command.



14
15
16
17
18
# File 'lib/latex2hiki.rb', line 14

def initialize(argv=[])
  @argv = argv
  @pre=@head=@post=nil
  @listings=false
end

Class Method Details

.run(argv = []) ⇒ Object



10
11
12
# File 'lib/latex2hiki.rb', line 10

def self.run(argv=[])
  new(argv).execute
end

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/latex2hiki.rb', line 20

def execute
  @argv << '--help' if @argv.size==0
  command_parser = OptionParser.new do |opt|
    opt.on('-v', '--version','show program Version.') { |v|
      opt.version = Latex2hiki::VERSION
      puts opt.ver
      exit
    }
  end
  command_parser.parse!(@argv)
  puts NKF.nkf("-w",Latex.new(File.read(ARGV[0])).to_hiki)
  exit
end