Skip to content

Instantly share code, notes, and snippets.

@josqu4red
Created October 8, 2014 15:31
Show Gist options
  • Select an option

  • Save josqu4red/83825b8840304ca711a1 to your computer and use it in GitHub Desktop.

Select an option

Save josqu4red/83825b8840304ca711a1 to your computer and use it in GitHub Desktop.

Revisions

  1. josqu4red created this gist Oct 8, 2014.
    9 changes: 9 additions & 0 deletions opt.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    OptionParser.new do |o|
    o.on('-H', '--host hostname') { |hostname| @host = hostname }
    o.on("-p", "--port port") { |port| @port = port }
    o.on('-h') { puts o; exit }
    o.parse!
    end

    raise OptionParser::MissingArgument if @host.nil?