Sha256: a42e1a5fa404b83356b78319841c102584e5655dd7b1a615263959c628c10e75

Contents?: true

Size: 345 Bytes

Versions: 5

Compression:

Stored size: 345 Bytes

Contents

#!/usr/bin/ruby
require 'optparse'

options = {:name => nil}

parser = OptionParser.new do|opts|
  opts.on('-n', '--name name', 'Give your own name') do |name|
    options[:name] = name;
    end

  opts.on('-h', '--help', 'Displays Help') do
    puts opts
    exit
    end
end

parser.parse!

sayHello = 'Hello ' + options[:name]

puts sayHello

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
my_help-0.6.1 docs/yagi/comparisons/optparse.rb
my_help-0.6.0 docs/yagi/comparisons/optparse.rb
my_help-0.5.2 docs/yagi/comparisons/optparse.rb
my_help-0.5.1 docs/yagi/comparisons/optparse.rb
my_help-0.5.0 docs/yagi/comparisons/optparse.rb