class GfmLivePreview::CLI
Constants
- DEFAULTS
Attributes
argv[R]
Public Class Methods
new(argv)
click to toggle source
# File lib/gfm_live_preview/cli.rb, line 11 def initialize(argv) @argv = argv end
parse(argv)
click to toggle source
# File lib/gfm_live_preview/cli.rb, line 15 def self.parse(argv) new(argv).parse end
Public Instance Methods
parse()
click to toggle source
# File lib/gfm_live_preview/cli.rb, line 19 def parse options = DEFAULTS.dup OptionParser.new do |opts| opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options] FILE" opts.on '-p', '--port PORT', 'Specify port other than 31337' do |port| options[:port] = port.to_i end end.parse(argv) file = argv.last if file.nil? @argv = ['-h'] parse end [file, options] end