Class: Birdwatcher::Commands::User

Inherits:
Birdwatcher::Command show all
Defined in:
lib/birdwatcher/commands/user.rb

Constant Summary

Constants inherited from Birdwatcher::Command

Birdwatcher::Command::ARGUMENT_SEPARATOR

Constants included from Birdwatcher::Concerns::Concurrency

Birdwatcher::Concerns::Concurrency::DEFAULT_THREAD_POOL_SIZE

Constants included from Birdwatcher::Concerns::Core

Birdwatcher::Concerns::Core::DATA_DIRECTORY

Instance Attribute Summary

Attributes inherited from Birdwatcher::Command

#arguments

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Birdwatcher::Command

auto_completion, auto_completion_strings, descendants, #execute, has_name?, meta, meta=

Methods included from Birdwatcher::Concerns::Concurrency

included, #thread_pool

Methods included from Birdwatcher::Concerns::Persistence

included, #save_status, #save_user

Methods included from Birdwatcher::Concerns::Presentation

included, #make_status_summary_output, #make_url_summary_output, #make_user_details_output, #make_user_summary_output, #output_status_summary, #output_user_details, #output_user_summary, #page_text

Methods included from Birdwatcher::Concerns::Outputting

#confirm, #error, #fatal, included, #info, #line_separator, #newline, #output, #output_formatted, #task, #warn

Methods included from Birdwatcher::Concerns::Util

#escape_html, #excerpt, included, #number_to_human_size, #parse_time, #pluralize, #strip_control_characters, #strip_html, #suppress_output, #suppress_warnings, #time_ago_in_words, #unescape_html

Methods included from Birdwatcher::Concerns::Core

#console, #current_workspace, #current_workspace=, #database, included, #klout_client, #read_data_file, #twitter_client

Class Method Details

.detailed_usageObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/birdwatcher/commands/user.rb', line 10

def self.detailed_usage
<<-USAGE
The #{'user'.bold} command manipulates users in the current workspace.

#{'USAGE:'.bold}

#{'List all users in the workspace:'.bold}
  user list

#{'Add one or more users to the workspace:'.bold}
  user create [USER1[ USER2 ... USERN]]

#{'Update information on one or more users:'.bold}
  user update [USER1[ USER2 ... USERN]]

#{'Delete one or more users from the workspace:'.bold}
  user delete [USER1[ USER2 ... USERN]]
USAGE
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/birdwatcher/commands/user.rb', line 30

def run
  if !arguments?
    error("You must provide an action")
    return false
  end
  action = arguments.first.downcase
  case action
  when "list"
    list_users
  when "create", "add", "-a"
    create_users
  when "update", "-u"
    update_users
  when "delete", "destroy", "rm", "-d"
    delete_users
  else
    list_user
  end
end