mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-31 03:26:21 +00:00
Split help into sections
Most of the time complete help was too big for the screen
This commit is contained in:
@@ -91,13 +91,15 @@ static struct cmd_t main_commands[] =
|
|||||||
{
|
{
|
||||||
{ "/help",
|
{ "/help",
|
||||||
_cmd_help,
|
_cmd_help,
|
||||||
{ "/help [command]", "Show help summary, or help on a specific command",
|
{ "/help [area|command]", "Show help summary, or help on a specific area or command",
|
||||||
{ "/help [command]",
|
{ "/help [area|command]",
|
||||||
"---------------",
|
"---------------",
|
||||||
"List all commands with short help on what they do.",
|
"Show help options.",
|
||||||
|
"Specify an area (basic, status, settings, navigation) for more help on that area.",
|
||||||
"Specify the command if you want more detailed help on a specific command.",
|
"Specify the command if you want more detailed help on a specific command.",
|
||||||
"",
|
"",
|
||||||
"Example : /help connect",
|
"Example : /help connect",
|
||||||
|
"Example : /help settings",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/connect",
|
{ "/connect",
|
||||||
@@ -363,6 +365,10 @@ cmd_init(void)
|
|||||||
log_info("Initialising commands");
|
log_info("Initialising commands");
|
||||||
commands_ac = p_autocomplete_new();
|
commands_ac = p_autocomplete_new();
|
||||||
help_ac = p_autocomplete_new();
|
help_ac = p_autocomplete_new();
|
||||||
|
p_autocomplete_add(help_ac, strdup("basic"));
|
||||||
|
p_autocomplete_add(help_ac, strdup("status"));
|
||||||
|
p_autocomplete_add(help_ac, strdup("settings"));
|
||||||
|
p_autocomplete_add(help_ac, strdup("navigation"));
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(main_commands); i++) {
|
for (i = 0; i < ARRAY_SIZE(main_commands); i++) {
|
||||||
@@ -551,6 +557,14 @@ _cmd_help(const char * const inp, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
if (strcmp(inp, "/help") == 0) {
|
if (strcmp(inp, "/help") == 0) {
|
||||||
cons_help();
|
cons_help();
|
||||||
|
} else if (strcmp(inp, "/help basic") == 0) {
|
||||||
|
cons_basic_help();
|
||||||
|
} else if (strcmp(inp, "/help status") == 0) {
|
||||||
|
cons_status_help();
|
||||||
|
} else if (strcmp(inp, "/help settings") == 0) {
|
||||||
|
cons_settings_help();
|
||||||
|
} else if (strcmp(inp, "/help navigation") == 0) {
|
||||||
|
cons_navigation_help();
|
||||||
} else {
|
} else {
|
||||||
char *cmd = strndup(inp+6, strlen(inp)-6);
|
char *cmd = strndup(inp+6, strlen(inp)-6);
|
||||||
char cmd_with_slash[1 + strlen(cmd) + 1];
|
char cmd_with_slash[1 + strlen(cmd) + 1];
|
||||||
|
|||||||
4
src/ui.h
4
src/ui.h
@@ -104,6 +104,10 @@ void win_remind(void);
|
|||||||
|
|
||||||
// console window actions
|
// console window actions
|
||||||
void cons_help(void);
|
void cons_help(void);
|
||||||
|
void cons_basic_help(void);
|
||||||
|
void cons_settings_help(void);
|
||||||
|
void cons_status_help(void);
|
||||||
|
void cons_navigation_help(void);
|
||||||
void cons_prefs(void);
|
void cons_prefs(void);
|
||||||
void cons_bad_command(const char * const cmd);
|
void cons_bad_command(const char * const cmd);
|
||||||
void cons_show(const char * const cmd, ...);
|
void cons_show(const char * const cmd, ...);
|
||||||
|
|||||||
@@ -573,11 +573,35 @@ _cons_show_basic_help(void)
|
|||||||
|
|
||||||
void
|
void
|
||||||
cons_help(void)
|
cons_help(void)
|
||||||
|
{
|
||||||
|
cons_show("");
|
||||||
|
cons_show("Choose an area you need help with:");
|
||||||
|
cons_show("");
|
||||||
|
cons_show("/help basic - Basic commands, for connecting, chatting etc.");
|
||||||
|
cons_show("/help status - How to change your status.");
|
||||||
|
cons_show("/help settings - Commands for configuring Profanity.");
|
||||||
|
cons_show("/help navigation - How to navigate around Profanity.");
|
||||||
|
cons_show("");
|
||||||
|
|
||||||
|
if (_curr_prof_win == 0)
|
||||||
|
dirty = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_basic_help(void)
|
||||||
{
|
{
|
||||||
cons_show("");
|
cons_show("");
|
||||||
cons_show("Basic Commands:");
|
cons_show("Basic Commands:");
|
||||||
_cons_show_basic_help();
|
_cons_show_basic_help();
|
||||||
|
|
||||||
|
if (_curr_prof_win == 0)
|
||||||
|
dirty = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_settings_help(void)
|
||||||
|
{
|
||||||
|
cons_show("");
|
||||||
cons_show("Settings:");
|
cons_show("Settings:");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
||||||
@@ -587,7 +611,16 @@ cons_help(void)
|
|||||||
cons_show("%-25s: %s", help->usage, help->short_help);
|
cons_show("%-25s: %s", help->usage, help->short_help);
|
||||||
settings_helpers = g_slist_next(settings_helpers);
|
settings_helpers = g_slist_next(settings_helpers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cons_show("");
|
||||||
|
|
||||||
|
if (_curr_prof_win == 0)
|
||||||
|
dirty = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_status_help(void)
|
||||||
|
{
|
||||||
cons_show("");
|
cons_show("");
|
||||||
cons_show("Status changes:");
|
cons_show("Status changes:");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
@@ -599,6 +632,15 @@ cons_help(void)
|
|||||||
status_helpers = g_slist_next(status_helpers);
|
status_helpers = g_slist_next(status_helpers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cons_show("");
|
||||||
|
|
||||||
|
if (_curr_prof_win == 0)
|
||||||
|
dirty = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_navigation_help(void)
|
||||||
|
{
|
||||||
cons_show("");
|
cons_show("");
|
||||||
cons_show("Navigation:");
|
cons_show("Navigation:");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|||||||
Reference in New Issue
Block a user