Skip to content

Commit 26b272d

Browse files
committed
add logout subcommand
1 parent 782b700 commit 26b272d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/cli/acc.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ import {version} from "../../package.json";
33
import {AtCoder} from "../atcoder";
44
import {OnlineJudge} from "../facade/oj";
55
import {init} from "../project";
6+
import getConfig from "../config";
67

78
async function login() {
89
const atcoder = new AtCoder();
910
console.log(await atcoder.login());
1011
}
1112

13+
async function logout() {
14+
getConfig().delete("cookies");
15+
console.log("login session aborted.")
16+
}
17+
1218
async function session() {
1319
const atcoder = new AtCoder();
1420
console.log("check login status...");
@@ -57,6 +63,11 @@ commander
5763
.action(async () => await login())
5864
.description("login to AtCoder");
5965

66+
commander
67+
.command("logout")
68+
.action(async () => await logout())
69+
.description("delete login session information");
70+
6071
commander
6172
.command("session")
6273
.action(async () => await session())

0 commit comments

Comments
 (0)