Skip to content

Commit

Permalink
Re-request the Username if an empty string is passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed Jan 30, 2011
1 parent fab8cc1 commit ae6c265
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/github/command.rb
Expand Up @@ -68,19 +68,26 @@ def die(message)

def github_user
user = git("config --get github.user")
request_github_credentials && github_user if user.empty?
if user.empty?
request_github_credentials
user = github_user
end
user
end

def github_token
token = git("config --get github.token")
request_github_credentials && github_token if token.empty?
if token.empty?
request_github_credentials
token = github_token
end
token
end

def request_github_credentials
puts "Please enter your GitHub credentials:"
user = highline.ask("Username: ")
user = highline.ask("Username: ") while user.nil? || user.empty?

git("config --global github.user '#{user}'")
puts("Your account token is at https://github.com/account under 'Account Admin'.")
puts("Press Enter to launch page in browser.")
Expand Down

0 comments on commit ae6c265

Please sign in to comment.