Skip to content

Instantly share code, notes, and snippets.

@sondr3
Last active November 21, 2015 21:23
Show Gist options
  • Save sondr3/c4739d6e17a6efdea4ae to your computer and use it in GitHub Desktop.
Save sondr3/c4739d6e17a6efdea4ae to your computer and use it in GitHub Desktop.
# bin/test.rb
opts.on('--new:thing [NAME]', 'create a new thing') do |name|
if name.nil?
puts "you need to name your thing"
exit 0
end
options[:name] = name
puts "#{name}"
Test::CLI::New::Thing.new
end
# lib/test/cli.rb
module Test
module CLI
module New
class Thing
def initialize(name)
@name = name
puts "it's a thing: #{name}'"
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment