Skip to content

Instantly share code, notes, and snippets.

@nuke99
Created May 9, 2012 04:56
Show Gist options
  • Save nuke99/2641917 to your computer and use it in GitHub Desktop.
Save nuke99/2641917 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require './lib/trollop'
opts = Trollop::options do
version "test 1.1 "
banner <<-EOS
This is a sample banner for my test script
EOS
opt :name, "This is the name" , :short => 'n', :type=>String, :required => true
opt :age, "This is the value of age", :short => 'a' , :type=>Integer
opt :test, "this is a test command", :short => 't', :type=>String
end
loka = opts[:name]
def namef(loka)
puts "My Name is #{loka}"
end
def agef(opts[:age])
puts "and my age is #{opts[:age]}"
end
def testf(opts[:test])
puts "and this could be something else as #{opts[:test]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment