Skip to content

Commit 53118cd

Browse files
author
Chris Hunt
committed
Remove print_* methods from auth/cli
1 parent acd2ad2 commit 53118cd

1 file changed

Lines changed: 8 additions & 28 deletions

File tree

lib/github/auth/cli.rb

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def execute
1414
if COMMANDS.include?(command)
1515
send command
1616
elsif command == '--version'
17-
print_version
17+
puts "gh-auth version #{Github::Auth::VERSION}"
1818
else
1919
print_usage
2020
end
@@ -54,41 +54,19 @@ def on_keys_file(action, message)
5454
def rescue_keys_file_errors
5555
yield
5656
rescue KeysFile::PermissionDeniedError
57-
print_permission_denied
58-
rescue KeysFile::FileDoesNotExistError
59-
print_file_does_not_exist
60-
end
61-
62-
def print_usage
63-
puts "usage: gh-auth [--version] [#{COMMANDS.join '|'}] <username>"
64-
end
65-
66-
def print_version
67-
puts "gh-auth version #{Github::Auth::VERSION}"
68-
end
69-
70-
def print_permission_denied
7157
puts 'Permission denied!'
7258
puts
7359
puts "Make sure you have write permissions for '#{keys_file.path}'"
74-
end
75-
76-
def print_file_does_not_exist
60+
rescue KeysFile::FileDoesNotExistError
7761
puts "Keys file does not exist!"
7862
puts
7963
puts "Create one now and try again:"
8064
puts
8165
puts " $ touch #{keys_file.path}"
8266
end
8367

84-
def print_github_user_does_not_exist(username)
85-
puts "Github user '#{username}' does not exist"
86-
end
87-
88-
def print_github_unavailable
89-
puts "Github appears to be unavailable :("
90-
puts
91-
puts "https://status.github.com"
68+
def print_usage
69+
puts "usage: gh-auth [--version] [#{COMMANDS.join '|'}] <username>"
9270
end
9371

9472
def keys
@@ -101,9 +79,11 @@ def keys_for(username)
10179
username: username
10280
).keys
10381
rescue Github::Auth::KeysClient::GithubUserDoesNotExistError
104-
print_github_user_does_not_exist username
82+
puts "Github user '#{username}' does not exist"
10583
rescue Github::Auth::KeysClient::GithubUnavailableError
106-
print_github_unavailable
84+
puts "Github appears to be unavailable :("
85+
puts
86+
puts "https://status.github.com"
10787
end
10888

10989
def keys_file

0 commit comments

Comments
 (0)