diff options
author | James Booth <boothj5@gmail.com> | 2016-02-18 22:25:43 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-02-18 22:25:43 +0000 |
commit | 412dc13629cd1dcfba0f8542ebd4f2079d6d0c62 (patch) | |
tree | 3e2cbbd9124b936369883624c4c1296f2d746477 /src | |
parent | 0ed3b53bd2a160b81cf16d1b4915164138205eb2 (diff) | |
download | profani-tty-412dc13629cd1dcfba0f8542ebd4f2079d6d0c62.tar.gz |
Added prof_cons_bad_cmd_usage plugin function
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/api.c | 8 | ||||
-rw-r--r-- | src/plugins/api.h | 1 | ||||
-rw-r--r-- | src/plugins/c_api.c | 9 | ||||
-rw-r--r-- | src/plugins/profapi.c | 2 | ||||
-rw-r--r-- | src/plugins/profapi.h | 2 | ||||
-rw-r--r-- | src/ui/console.c | 43 |
6 files changed, 20 insertions, 45 deletions
diff --git a/src/plugins/api.c b/src/plugins/api.c index 00e1f1e9..8db53091 100644 --- a/src/plugins/api.c +++ b/src/plugins/api.c @@ -64,6 +64,14 @@ api_cons_show(const char * const message) } void +api_cons_bad_cmd_usage(const char *const cmd) +{ + if (cmd) { + cons_bad_cmd_usage(cmd); + } +} + +void api_register_command(const char *command_name, int min_args, int max_args, const char **synopsis, const char *description, const char *arguments[][2], const char **examples, void *callback, void(*callback_func)(PluginCommand *command, gchar **args)) diff --git a/src/plugins/api.h b/src/plugins/api.h index e0682033..b156c7e6 100644 --- a/src/plugins/api.h +++ b/src/plugins/api.h @@ -39,6 +39,7 @@ void api_cons_alert(void); void api_cons_show(const char * const message); +void api_cons_bad_cmd_usage(const char *const cmd); void api_notify(const char *message, const char *category, int timeout_ms); void api_send_line(char *line); char * api_get_current_recipient(void); diff --git a/src/plugins/c_api.c b/src/plugins/c_api.c index bb4edb01..c058645e 100644 --- a/src/plugins/c_api.c +++ b/src/plugins/c_api.c @@ -68,6 +68,14 @@ c_api_cons_show(const char * const message) } static void +c_api_cons_bad_cmd_usage(const char *const cmd) +{ + if (cmd) { + api_cons_bad_cmd_usage(cmd); + } +} + +static void c_api_register_command(const char *command_name, int min_args, int max_args, const char **synopsis, const char *description, const char *arguments[][2], const char **examples, void(*callback)(char **args)) @@ -219,6 +227,7 @@ c_api_init(void) { prof_cons_alert = c_api_cons_alert; prof_cons_show = c_api_cons_show; + prof_cons_bad_cmd_usage = c_api_cons_bad_cmd_usage; prof_register_command = c_api_register_command; prof_register_timed = c_api_register_timed; prof_register_ac = c_api_register_ac; diff --git a/src/plugins/profapi.c b/src/plugins/profapi.c index ceeab254..a787a7a5 100644 --- a/src/plugins/profapi.c +++ b/src/plugins/profapi.c @@ -38,8 +38,8 @@ #include "plugins/callbacks.h" void (*prof_cons_alert)(void) = NULL; - void (*prof_cons_show)(const char * const message) = NULL; +void (*prof_cons_bad_cmd_usage)(const char *const cmd) = NULL; void (*prof_register_command)(const char *command_name, int min_args, int max_args, const char **synopsis, const char *description, const char *arguments[][2], const char **examples, diff --git a/src/plugins/profapi.h b/src/plugins/profapi.h index b1ecf352..b7a5305d 100644 --- a/src/plugins/profapi.h +++ b/src/plugins/profapi.h @@ -38,8 +38,8 @@ typedef char* PROF_WIN_TAG; void (*prof_cons_alert)(void); - void (*prof_cons_show)(const char * const message); +void (*prof_cons_bad_cmd_usage)(const char *const cmd); void (*prof_register_command)(const char *command_name, int min_args, int max_args, const char **synopsis, const char *description, const char *arguments[][2], const char **examples, diff --git a/src/ui/console.c b/src/ui/console.c index 0ec1281e..dd1dc065 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -162,49 +162,6 @@ cons_show_help(const char *const cmd, CommandHelp *help) } } -//void -//cons_show_help(Command *command) -//{ -// ProfWin *console = wins_get_console(); -// -// cons_show(""); -// win_vprint(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "%s", &command->cmd[1]); -// win_print(console, '-', 0, NULL, NO_EOL, THEME_WHITE_BOLD, "", ""); -// int i; -// for (i = 0; i < strlen(command->cmd) - 1 ; i++) { -// win_print(console, '-', 0, NULL, NO_EOL | NO_DATE, THEME_WHITE_BOLD, "", "-"); -// } -// win_print(console, '-', 0, NULL, NO_DATE, THEME_WHITE_BOLD, "", ""); -// cons_show(""); -// -// win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Synopsis"); -// ui_show_lines(console, command->help.synopsis); -// cons_show(""); -// -// win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Description"); -// win_println(console, 0, command->help.desc); -// -// int maxlen = 0; -// for (i = 0; command->help.args[i][0] != NULL; i++) { -// if (strlen(command->help.args[i][0]) > maxlen) -// maxlen = strlen(command->help.args[i][0]); -// } -// -// if (i > 0) { -// cons_show(""); -// win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Arguments"); -// for (i = 0; command->help.args[i][0] != NULL; i++) { -// win_vprint(console, '-', maxlen + 3, NULL, 0, 0, "", "%-*s: %s", maxlen + 1, command->help.args[i][0], command->help.args[i][1]); -// } -// } -// -// if (g_strv_length((gchar**)command->help.examples) > 0) { -// cons_show(""); -// win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Examples"); -// ui_show_lines(console, command->help.examples); -// } -//} - void cons_bad_cmd_usage(const char *const cmd) { |