Skip to content

Commit 42e27c6

Browse files
committed
Totally remove login and logout command, and fix the problem that illegal command will be treated as "auth".
1 parent 5cf4e8a commit 42e27c6

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

cli/main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@ func main() {
411411
UsageText: `auth-thu [options]
412412
auth-thu [options] auth [auth_options]
413413
auth-thu [options] deauth [auth_options]
414-
auth-thu [options] login
415-
auth-thu [options] logout
416414
auth-thu [options] online [online_options]`,
417415
Usage: "Authenticating utility for Tsinghua",
418416
Version: "2.3.5",
@@ -470,7 +468,14 @@ func main() {
470468
Action: cmdKeepalive,
471469
},
472470
},
473-
Action: cmdAuth,
471+
Action: func(c *cli.Context) {
472+
if len(c.Args()) > 0 {
473+
fmt.Printf("Command not found: %v\n\n", c.Args()[0])
474+
cli.ShowAppHelpAndExit(c, 0)
475+
} else { // when no command, default to auth
476+
cmdAuth(c)
477+
}
478+
},
474479
Authors: []cli.Author{
475480
{Name: "Yuxiang Zhang", Email: "yuxiang.zhang@tuna.tsinghua.edu.cn"},
476481
{Name: "Nogeek", Email: "ritou11@gmail.com"},

docs/init.d/goauthing

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ generate_command() {
1111
CMD="\
1212
\"$PROG\" -c \"$CONF\" -D deauth; \
1313
\"$PROG\" -c \"$CONF\" -D auth; \
14-
\"$PROG\" -c \"$CONF\" -D login; \
15-
\"$PROG\" -c \"$CONF\" -D online; \
14+
\"$PROG\" -c \"$CONF\" online; \
1615
"
1716
}
1817

@@ -27,5 +26,5 @@ start_service() {
2726
}
2827

2928
stop_service() {
30-
"$PROG" -c "$CONF" -D logout
29+
"$PROG" -c "$CONF" -D deauth
3130
}

docs/init.d/goauthing@

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ generate_command() {
1111
CMD="\
1212
\"$PROG\" $1 deauth; \
1313
\"$PROG\" $1 auth; \
14-
\"$PROG\" $1 login; \
1514
\"$PROG\" $1 online; \
1615
"
1716
}
@@ -32,21 +31,11 @@ start_instance() {
3231
procd_close_instance
3332
}
3433

35-
logout() {
36-
local username password
37-
config_get username config username
38-
config_get password config password
39-
local args="-u $username -p $password"
40-
41-
"$PROG" $args logout
42-
}
43-
4434
start_service() {
4535
config_load "$SERV"
4636
start_instance
4737
}
4838

4939
stop_service() {
50-
config_load "$SERV"
51-
logout
40+
"$PROG" deauth
5241
}

0 commit comments

Comments
 (0)