@@ -56,6 +56,11 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
56
56
. infer_subcommands ( pre_flight_settings. infer_subcommands )
57
57
. infer_long_args ( pre_flight_settings. infer_long_options )
58
58
. subcommands ( close_subcommands ( pre_flight_settings. clone ( ) ) ) ;
59
+ let connections_group = Command :: new ( "connections" )
60
+ . about ( "Operations on connections" )
61
+ . infer_subcommands ( pre_flight_settings. infer_subcommands )
62
+ . infer_long_args ( pre_flight_settings. infer_long_options )
63
+ . subcommands ( connections_subcommands ( pre_flight_settings. clone ( ) ) ) ;
59
64
let declare_group = Command :: new ( "declare" )
60
65
. about ( "Creates or declares objects" )
61
66
. infer_subcommands ( pre_flight_settings. infer_subcommands )
@@ -283,6 +288,7 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
283
288
let command_groups = [
284
289
bindings_group,
285
290
close_group,
291
+ connections_group,
286
292
declare_group,
287
293
definitions_group,
288
294
delete_group,
@@ -574,7 +580,7 @@ fn list_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 19] {
574
580
. short ( 'u' )
575
581
. long ( "username" )
576
582
. required ( true )
577
- . help ( "Name of the user whose connections to list " ) ,
583
+ . help ( "Name of the user whose connections should be listed " ) ,
578
584
)
579
585
. long_about ( "Lists client connections that authenticated with a specific username" )
580
586
. after_help ( color_print:: cformat!(
@@ -1842,6 +1848,53 @@ fn close_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 2] {
1842
1848
. map ( |cmd| cmd. infer_long_args ( pre_flight_settings. infer_long_options ) )
1843
1849
}
1844
1850
1851
+ fn connections_subcommands ( pre_flight_settings : PreFlightSettings ) -> [ Command ; 4 ] {
1852
+ let close_connection = Command :: new ( "close" )
1853
+ . about ( "Closes a client connection" )
1854
+ . arg (
1855
+ Arg :: new ( "name" )
1856
+ . long ( "name" )
1857
+ . help ( "connection name (identifying string)" )
1858
+ . required ( true ) ,
1859
+ ) ;
1860
+ let close_user_connections = Command :: new ( "close_of_user" )
1861
+ . about ( "Closes all connections that are authenticated with a specific username" )
1862
+ . arg (
1863
+ Arg :: new ( "username" )
1864
+ . short ( 'u' )
1865
+ . long ( "username" )
1866
+ . help ( "Name of the user whose connections should be closed" )
1867
+ . required ( true ) ,
1868
+ ) ;
1869
+ let list_cmd = Command :: new ( "list" )
1870
+ . long_about ( "Lists client connections" )
1871
+ . after_help ( color_print:: cformat!(
1872
+ "<bold>Doc guide</bold>: {}" ,
1873
+ CONNECTION_GUIDE_URL
1874
+ ) ) ;
1875
+ let list_user_connections_cmd = Command :: new ( "list_of_user" )
1876
+ . arg (
1877
+ Arg :: new ( "username" )
1878
+ . short ( 'u' )
1879
+ . long ( "username" )
1880
+ . required ( true )
1881
+ . help ( "Name of the user whose connections should be listed" ) ,
1882
+ )
1883
+ . long_about ( "Lists client connections that are authenticated with a specific username" )
1884
+ . after_help ( color_print:: cformat!(
1885
+ "<bold>Doc guide</bold>: {}" ,
1886
+ CONNECTION_GUIDE_URL
1887
+ ) ) ;
1888
+
1889
+ [
1890
+ close_connection,
1891
+ close_user_connections,
1892
+ list_cmd,
1893
+ list_user_connections_cmd,
1894
+ ]
1895
+ . map ( |cmd| cmd. infer_long_args ( pre_flight_settings. infer_long_options ) )
1896
+ }
1897
+
1845
1898
fn definitions_subcommands ( pre_flight_settings : PreFlightSettings ) -> [ Command ; 4 ] {
1846
1899
let export_cmd = Command :: new ( "export" )
1847
1900
. about ( "Export cluster-wide definitions" )
@@ -2365,7 +2418,7 @@ pub fn users_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 6]
2365
2418
. short ( 'u' )
2366
2419
. long ( "username" )
2367
2420
. required ( true )
2368
- . help ( "Name of the user whose connections to list " ) ,
2421
+ . help ( "Name of the user whose connections should be listed " ) ,
2369
2422
)
2370
2423
. long_about ( "Lists client connections that authenticated with a specific username" )
2371
2424
. after_help ( color_print:: cformat!(
0 commit comments