1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added connect to new help format

This commit is contained in:
James Booth 2015-07-24 00:33:38 +01:00
parent 22111bf75b
commit 44d7a152a4
2 changed files with 63 additions and 56 deletions

View File

@ -104,68 +104,75 @@ static char * _receipts_autocomplete(ProfWin *window, const char * const input);
GHashTable *commands = NULL; GHashTable *commands = NULL;
#define END_ARGS { NULL, NULL }
/* /*
* Command list * Command list
*/ */
static struct cmd_t command_defs[] = static struct cmd_t command_defs[] =
{ {
// NEW STYLE // NEW STYLE
{ "/help", cmd_help, parse_args, 0, 1, NULL, { "/help",
cmd_help, parse_args, 0, 1, NULL,
{ NULL, NULL, { NULL }, { NULL, NULL, { NULL },
{ {
"/help [<area>|<command>]", "/help [<area>|<command>]",
NULL }, NULL
},
"Help on using Profanity. Passing no arguments list help areas.", "Help on using Profanity. Passing no arguments list help areas.",
{ {
{ "area", "Summary help for commands in a certain area of functionality." }, { "area", "Summary help for commands in a certain area of functionality." },
{ "command", "Full help for a specific command, for example '/help connect'." }, { "command", "Full help for a specific command, for example '/help connect'." },
{ NULL, NULL } }, END_ARGS },
{ {
"/help commands", "/help commands",
"/help presence", "/help presence",
"/help who", "/help who",
NULL } } }, NULL } }
},
{ "/about", cmd_about, parse_args, 0, 0, NULL, { "/about",
cmd_about, parse_args, 0, 0, NULL,
{ NULL, NULL, { NULL }, { NULL, NULL, { NULL },
{ {
"/about", "/about",
NULL }, NULL
},
"Show version and license information.", "Show version and license information.",
{ {
{ NULL, NULL } }, END_ARGS },
{ {
NULL } } }, NULL } }
},
// OLD STYLE
{ "/connect", { "/connect",
cmd_connect, parse_args, 0, 5, NULL, cmd_connect, parse_args, 0, 5, NULL,
{ "/connect [account] [server value] [port value]", "Account login.", { NULL, NULL, { NULL },
{ "/connect [account] [server value] [port value]", {
"----------------------------------------------", "/connect [<account>]",
"Login to a chat service.", "/connect <account> [server <server>] [port <port>]",
"", NULL
"account : The local account you wish to connect with, or a JID if connecting for the first time.", },
"server value : Supply a server if it is different to the domain part of your JID.", "Login to a chat service. "
"port value : The port to use if different to the default (5222, or 5223 for SSL).", "If no account is specified, the default is used if one is configured. "
"",
"If no account is specified, the default is used if one is configured.",
"A local account is created with the JID as it's name if it doesn't already exist.", "A local account is created with the JID as it's name if it doesn't already exist.",
"", {
"Example: /connect", { "account", "The local account you wish to connect with, or a JID if connecting for the first time." },
"Example: /connect myuser@gmail.com", { "server <server>", "Supply a server if it is different to the domain part of your JID." },
"Example: /connect myuser@mycompany.com server talk.google.com", { "port <port>", "The port to use if different to the default (5222, or 5223 for SSL)." },
"Example: /connect bob@someplace port 5678", END_ARGS },
"Example: /connect me@chatty server chatty.com port 5443", {
NULL, "/connect",
NULL, NULL, NULL, NULL } } }, "/connect myuser@gmail.com",
"/connect myuser@mycompany.com server talk.google.com",
"/connect bob@someplace port 5678",
"/connect me@chatty server chatty.com port 5443",
NULL } }
},
// OLD STYLE
{ "/disconnect", { "/disconnect",
cmd_disconnect, parse_args, 0, 0, NULL, cmd_disconnect, parse_args, 0, 0, NULL,

View File

@ -112,11 +112,11 @@ cons_show_help(Command *command)
cons_show(""); cons_show("");
cons_show("Synopsis:"); win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Synopsis");
ui_show_lines(console, command->help.synopsis); ui_show_lines(console, command->help.synopsis);
cons_show(""); cons_show("");
cons_show("Description:"); win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Description");
win_println(console, command->help.desc); win_println(console, command->help.desc);
int i; int i;
@ -128,7 +128,7 @@ cons_show_help(Command *command)
if (i > 0) { if (i > 0) {
cons_show(""); cons_show("");
cons_show("Arguments:"); win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Arguments");
for (i = 0; command->help.args[i][0] != NULL; i++) { for (i = 0; command->help.args[i][0] != NULL; i++) {
win_vprint(console, '-', NULL, 0, 0, "", "%-*s: %s", maxlen + 1, command->help.args[i][0], command->help.args[i][1]); win_vprint(console, '-', NULL, 0, 0, "", "%-*s: %s", maxlen + 1, command->help.args[i][0], command->help.args[i][1]);
} }
@ -136,7 +136,7 @@ cons_show_help(Command *command)
if (g_strv_length((gchar**)command->help.examples) > 0) { if (g_strv_length((gchar**)command->help.examples) > 0) {
cons_show(""); cons_show("");
cons_show("Examples:"); win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Examples");
ui_show_lines(console, command->help.examples); ui_show_lines(console, command->help.examples);
} }
} }