@@ -7,6 +7,7 @@ use crate::application::server::context::Context;
7
7
use crate :: application:: server:: frame:: Frame ;
8
8
9
9
mod id;
10
+ mod info;
10
11
mod list;
11
12
mod set_info;
12
13
mod set_name;
@@ -18,6 +19,7 @@ pub enum Client {
18
19
SetName ( set_name:: ClientSetName ) ,
19
20
List ( list:: ClientList ) ,
20
21
Id ( id:: ClientID ) ,
22
+ Info ( info:: ClientInfo ) ,
21
23
}
22
24
23
25
// TODO(@miaxos): This is a simple implementation of the HELP to have the
@@ -26,6 +28,8 @@ pub enum Client {
26
28
const HELP_TEXT : & str = r#"CLIENT <subcommand> [<arg> [value] [opt] ...]. subcommands are:
27
29
ID
28
30
Return the ID of the current connection.
31
+ INFO
32
+ Return information about the current client connection.
29
33
LIST [options ...]
30
34
Return information about client connections. Options:
31
35
* TYPE (NORMAL|MASTER|REPLICA|PUBSUB)
@@ -64,6 +68,9 @@ impl SubcommandRegistry for Client {
64
68
"id" => Command :: Client ( Client :: Id ( id:: ClientID :: parse_frames (
65
69
& mut parse,
66
70
) ?) ) ,
71
+ "info" => Command :: Client ( Client :: Info (
72
+ info:: ClientInfo :: parse_frames ( & mut parse) ?,
73
+ ) ) ,
67
74
"list" => Command :: Client ( Client :: List (
68
75
list:: ClientList :: parse_frames ( & mut parse) ?,
69
76
) ) ,
@@ -114,6 +121,7 @@ impl CommandExecution for Client {
114
121
Client :: SetInfo ( cmd) => cmd. apply ( dst, ctx) . await ,
115
122
Client :: SetName ( cmd) => cmd. apply ( dst, ctx) . await ,
116
123
Client :: Id ( cmd) => cmd. apply ( dst, ctx) . await ,
124
+ Client :: Info ( cmd) => cmd. apply ( dst, ctx) . await ,
117
125
Client :: List ( cmd) => cmd. apply ( dst, ctx) . await ,
118
126
}
119
127
}
0 commit comments