Skip to content

Instantly share code, notes, and snippets.

@punnie
Created March 12, 2013 17:44
Show Gist options
  • Save punnie/5145155 to your computer and use it in GitHub Desktop.
Save punnie/5145155 to your computer and use it in GitHub Desktop.
require './lib/clishe'
class Console < Clishe::Base
command 'user' do |c|
c.parameter 'action', %w[add delete set], 'action to perform'
c.parameter 'username', String, 'the new user\'s username'
c.parameter 'email', /^\w+\.\w+@\w+\.\w+/, 'the new user\'s email address'
c.action do
puts c.params[:username]
puts c.params[:email]
end
end
command 'userdel' do |c|
c.parameter 'username', String, 'the user\'s username'
c.action do
puts "deleting #{c.params[:username]}"
end
end
command 'quit' do |c|
c.action do
exit
end
end
run!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment