Class: Git::Copilot::CLI::User
- Inherits:
-
Thor
- Object
- Thor
- Git::Copilot::CLI::User
- Includes:
- Git::Copilot::Configuration
- Defined in:
- lib/git/copilot/cli/user.rb
Instance Method Summary collapse
Instance Method Details
#add(username) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/git/copilot/cli/user.rb', line 8 def add(username) name = ask "Git author name:" email = ask "Git author email:" user = add_user(username, name, email) commit_config say %(Added #{user.to_committer} as "#{user.username}") end |
#list ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/git/copilot/cli/user.rb', line 28 def list return say "No users found" if users.empty? user_table = users.map do |username, user| [username, user.to_committer] end print_table user_table end |
#remove(username) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/git/copilot/cli/user.rb', line 19 def remove(username) user = users.fetch(username) do return say_status "WARNING", "Unknown user #{username}", :yellow end users.delete(username) && commit_config if yes?("Remove #{user.to_committer}?") end |