Class: Giticious::Cli::User
- Inherits:
-
Thor
- Object
- Thor
- Giticious::Cli::User
- Defined in:
- lib/giticious/cli/user.rb
Instance Method Summary collapse
Instance Method Details
#create(username) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/giticious/cli/user.rb', line 6 def create(username) begin if Giticious::Service::User.new.create(username) puts "User #{username} has been created!" end list() rescue => e $stderr.puts e. exit 1 end end |
#delete(username) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/giticious/cli/user.rb', line 20 def delete(username) begin Giticious::Service::User.new.delete_by_username(username) rescue => e $stderr.puts e. exit 1 end end |
#list ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/giticious/cli/user.rb', line 30 def list begin rows = Giticious::Service::User.new.list.map { |result| result.values } table = Terminal::Table.new :headings => ["#", "Username"], :rows => rows puts table rescue => e $stderr.puts e. exit 1 end end |