Commit 8c1ea75910

8c1ea7591048b55e0553600d2207c6940745b66f

parent: 78d7909586

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2020-01-11 21:18 UTC

commands: More descriptions for the commands.

Layout: unified · split

src/commands.rs +30 −13
@@ -20,24 +20,24 @@ impl Commands {
2020 ) -> Commands {
2121 let matrix_desc = CommandDescription {
2222 name: "matrix",
23 description: "Matrix chat protocol command",
24 args: "server add <server-name> <hostname>[:<port>] ||\
23 description: "Matrix chat protocol command.",
24 args: "server add <server-name> <hostname>[:<port>]||\
2525 server delete|list|listfull <server-name> ||\
2626 connect <server-name> ||\
2727 disconnect <server-name> ||\
2828 reconnect <server-name> ||\
29 help <matrix-command>",
30 args_description: " server: list, add, or remove Matrix servers
31 connect: connect to Matrix servers
32 disconnect: disconnect from one or all Matrix servers
33 reconnect: reconnect to server(s)
34 help: show detailed command help\n
35Use /matrix help [command] to find out more.\n",
29 help <matrix-command> [<matrix-subcommand>]",
30 args_description: " server: List, add, or remove Matrix servers.
31 connect: Connect to Matrix servers.
32 disconnect: Disconnect from one or all Matrix servers.
33 reconnect: Reconnect to server(s).
34 help: Show detailed command help.\n
35Use /matrix [command] help to find out more.\n",
3636 completion: "server |add|delete|list|listfull ||
3737 connect ||
3838 disconnect ||
3939 reconnect ||
40 help",
40 help server|connect|disconnect|reconnect"
4141 };
4242
4343 let matrix = weechat.hook_command(
@@ -97,8 +97,10 @@ Use /matrix help [command] to find out more.\n",
9797 ) {
9898 let weechat = unsafe { Weechat::weechat() };
9999 let server_command = SubCommand::with_name("server")
100 .about("List, add or delete Matrix servers.")
100101 .subcommand(
101102 SubCommand::with_name("add")
103 .about("Add a new Matrix server.")
102104 .arg(
103105 Arg::with_name("name")
104106 .value_name("server-name")
@@ -110,17 +112,32 @@ Use /matrix help [command] to find out more.\n",
110112 .validator(MatrixServer::parse_homeserver_url),
111113 ),
112114 )
113 .subcommand(SubCommand::with_name("delete"));
115 .subcommand(
116 SubCommand::with_name("delete")
117 .about("Delete an existing Matrix server.")
118 .arg(
119 Arg::with_name("name")
120 .value_name("server-name")
121 .required(true),
122 ),
123 );
114124
115125 let argparse = Argparse::new("matrix")
126 .about("Matrix chat protocol command.")
116127 .global_setting(ArgParseSettings::ColorNever)
117128 .global_setting(ArgParseSettings::DisableHelpFlags)
118129 .global_setting(ArgParseSettings::DisableVersion)
119130 .global_setting(ArgParseSettings::VersionlessSubcommands)
120131 .setting(ArgParseSettings::SubcommandRequiredElseHelp)
121132 .subcommand(server_command)
122 .subcommand(SubCommand::with_name("connect"))
123 .subcommand(SubCommand::with_name("disconnect"));
133 .subcommand(
134 SubCommand::with_name("connect")
135 .about("Connect to Matrix servers."),
136 )
137 .subcommand(
138 SubCommand::with_name("disconnect")
139 .about("Disconnect from one or all Matrix servers"),
140 );
124141
125142 let matches = match argparse.get_matches_from_safe(args) {
126143 Ok(m) => m,