Class: Acclir::CLI

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

Overview

Acclir CLI

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/acclir/cli.rb', line 12

def self.exit_on_failure?
  true
end

Instance Method Details

#loginObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/acclir/cli.rb', line 17

def 
  username = ask("Username:")
  password = ask("Password:", echo: false)

  begin
    AtCoder::User.(username, password)

    say "\nLogin succeeded!"
  rescue AtCoder::LoginFailedError => e
    say_error "\n#{e.message}"
  end
end