Created
March 12, 2013 17:44
-
-
Save punnie/5145155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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