Class: GithubFlowCli::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/github_flow_cli/cli.rb

Instance Method Summary collapse

Instance Method Details

#loginObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/github_flow_cli/cli.rb', line 11

def 
  Config.username = ask("Github username:")
  password = ask("password:", echo: false)
  Config.oauth_token = authorize(Config.username, password)
  Config.save!
  puts "\nsuccessfully login!"
rescue Octokit::Unauthorized
  puts "\nauthentication failed, please try again."
  retry
end

#repoObject



28
29
30
# File 'lib/github_flow_cli/cli.rb', line 28

def repo
  puts(Local.repo&.slug || "remote repo not found!")
end

#userObject



23
24
25
# File 'lib/github_flow_cli/cli.rb', line 23

def user
  puts API.user[:login]
end