7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/ghrh/command/auth.rb', line 7
def execute
user = GHRH::Config.get('github.user') if not user
raise "No GitHub user given or set" if not user
pass = ask("Enter password for user #{user} (never stored): ") do |q|
q.echo = ''
end
token = GHRH::Auth.perform(user, pass)
if token
scope = local? == true ? "local" : "global"
GHRH::Config.set("ghrh.token", token, scope)
puts "ghrh.token set to #{token} in #{scope} git config"
else
puts "Authentication failed, invalid user or password"
end
end
|