lib/acclir/cli.rb in acclir-0.1.0 vs lib/acclir/cli.rb in acclir-0.2.0

- old
+ new

@@ -11,8 +11,22 @@ def self.exit_on_failure? true end + desc "login", "Login AtCoder" + def login + username = ask("Username:") + password = ask("Password:", echo: false) + + begin + AtCoder::User.login(username, password) + + say "\nLogin succeeded!" + rescue AtCoder::LoginFailedError => e + say_error "\n#{e.message}" + end + end + register(Command::New, "new", "new CONTEST_ID", "Generate files for the contest") end end