diff --git a/src/command.c b/src/command.c index 89e8645e..5bfb5101 100644 --- a/src/command.c +++ b/src/command.c @@ -116,13 +116,15 @@ static struct cmd_t main_commands[] = { { "/help", _cmd_help, - { "/help [area|command]", "Show help summary, or help on a specific area or command", - { "/help [area|command]", - "--------------------", + { "/help [list|area|command]", "Show help summary, or help on a specific area or command", + { "/help [list|area|command]", + "-------------------------", "Show help options.", + "Specify list if you want a list of all commands.", "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.", "", + "Example : /help list", "Example : /help connect", "Example : /help settings", NULL } } }, @@ -484,6 +486,7 @@ cmd_init(void) who_ac = p_autocomplete_new(); help_ac = p_autocomplete_new(); + p_autocomplete_add(help_ac, strdup("list")); p_autocomplete_add(help_ac, strdup("basic")); p_autocomplete_add(help_ac, strdup("status")); p_autocomplete_add(help_ac, strdup("settings")); @@ -875,6 +878,36 @@ _cmd_help(const char * const inp, struct cmd_help_t help) { if (strcmp(inp, "/help") == 0) { cons_help(); + } else if (strcmp(inp, "/help list") == 0) { + cons_show(""); + cons_show("Basic commands:"); + cons_show_time(); + unsigned int i; + for (i = 0; i < ARRAY_SIZE(main_commands); i++) { + cons_show_word( (main_commands+i)->cmd ); + if (i < ARRAY_SIZE(main_commands) - 1) { + cons_show_word(", "); + } + } + cons_show_word("\n"); + cons_show("Settings commands:"); + cons_show_time(); + for (i = 0; i < ARRAY_SIZE(setting_commands); i++) { + cons_show_word( (setting_commands+i)->cmd ); + if (i < ARRAY_SIZE(setting_commands) - 1) { + cons_show_word(", "); + } + } + cons_show_word("\n"); + cons_show("Status commands:"); + cons_show_time(); + for (i = 0; i < ARRAY_SIZE(status_commands); i++) { + cons_show_word( (status_commands+i)->cmd ); + if (i < ARRAY_SIZE(status_commands) - 1) { + cons_show_word(", "); + } + } + cons_show_word("\n"); } else if (strcmp(inp, "/help basic") == 0) { cons_basic_help(); } else if (strcmp(inp, "/help status") == 0) { diff --git a/src/ui.h b/src/ui.h index 9d958946..26bfb480 100644 --- a/src/ui.h +++ b/src/ui.h @@ -129,6 +129,8 @@ void cons_navigation_help(void); void cons_prefs(void); void cons_bad_command(const char * const cmd); void cons_show(const char * const cmd, ...); +void cons_show_time(void); +void cons_show_word(const char * const word); void cons_bad_show(const char * const cmd, ...); void cons_highlight_show(const char * const cmd); void cons_show_contacts(GSList * list); diff --git a/src/windows.c b/src/windows.c index 7b6d7267..77c7d1f7 100644 --- a/src/windows.c +++ b/src/windows.c @@ -937,12 +937,14 @@ void cons_help(void) { cons_show(""); - cons_show("Choose an area you need help with:"); + cons_show("Choose a help option:"); 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 list - List all commands."); + cons_show("/help basic - Summary of basic usgae commands."); + cons_show("/help status - Summary of online status change commands."); + cons_show("/help settings - Summary of commands for changing Profanity settings."); cons_show("/help navigation - How to navigate around Profanity."); + cons_show("/help [command] - Detailed help on a specific command."); cons_show(""); if (_curr_prof_win == 0) @@ -1100,6 +1102,12 @@ cons_bad_show(const char * const msg, ...) dirty = TRUE; } +void +cons_show_time(void) +{ + _win_show_time(_cons_win); +} + void cons_show(const char * const msg, ...) { @@ -1116,6 +1124,15 @@ cons_show(const char * const msg, ...) dirty = TRUE; } +void +cons_show_word(const char * const word) +{ + wprintw(_cons_win, "%s", word); + + if (_curr_prof_win == 0) + dirty = TRUE; +} + void cons_bad_command(const char * const cmd) {