class GithubFlowCli::CLI

Public Instance Methods

login() click to toggle source
# File lib/github_flow_cli/cli.rb, line 11
def login
  Config.username = ask("Github username:")
  password = ask("password:", echo: false)
  Config.oauth_token = authorize(Config.username, password)
  puts "\nsuccessfully login!"
rescue Octokit::Unauthorized
  puts "\nauthentication failed, please try again."
  retry
end
repo() click to toggle source
# File lib/github_flow_cli/cli.rb, line 27
def repo
  puts(Local.repo&.slug || "remote repo not found!")
end
user() click to toggle source
# File lib/github_flow_cli/cli.rb, line 22
def user
  puts API.user[:login]
end

Private Instance Methods

authorize(username, password) click to toggle source
# File lib/github_flow_cli/cli.rb, line 39
def authorize(username, password)
  API.authorize(username, password)
rescue Octokit::OneTimePasswordRequired
  two_factor_token = ask("\nTwo Factor Authentication code:")
  API.authorize(username, password, two_factor_token: two_factor_token)
end