Skip to content

Commit

Permalink
Prompt user if they haven't set up github in .gitconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie authored and stephencelis committed Apr 25, 2009
1 parent 47abd09 commit 1569e4a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/ghi.rb
Expand Up @@ -2,10 +2,24 @@ module GHI
VERSION = "0.0.4"

def self.login
`git config --get github.user`.chomp
return @login if defined? @login
@login = `git config --get github.user`.chomp
if @login.empty?
print "Please enter your GitHub username: "
@login = gets
`git config --global github.user #@login`
end
@login
end

def self.token
`git config --get github.token`.chomp
return @token if defined? @token
@token = `git config --get github.token`.chomp
if @token.empty?
print "GitHub token (https://github.com/account): "
@token = gets
`git config --global github.token #@token`
end
@token
end
end

0 comments on commit 1569e4a

Please sign in to comment.