mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 19:06:21 +00:00
Moved help and about to new format
This commit is contained in:
@@ -105,6 +105,42 @@ cons_show(const char * const msg, ...)
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
void
|
||||
cons_show_help(Command *command)
|
||||
{
|
||||
ProfWin *console = wins_get_console();
|
||||
|
||||
cons_show("");
|
||||
|
||||
cons_show("Synopsis:");
|
||||
ui_show_lines(console, command->help.synopsis);
|
||||
cons_show("");
|
||||
|
||||
cons_show("Description:");
|
||||
win_println(console, command->help.desc);
|
||||
|
||||
int i;
|
||||
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("");
|
||||
cons_show("Arguments:");
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_strv_length((gchar**)command->help.examples) > 0) {
|
||||
cons_show("");
|
||||
cons_show("Examples:");
|
||||
ui_show_lines(console, command->help.examples);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cons_show_error(const char * const msg, ...)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#ifndef UI_UI_H
|
||||
#define UI_UI_H
|
||||
|
||||
#include "command/commands.h"
|
||||
#include "ui/win_types.h"
|
||||
#include "muc.h"
|
||||
|
||||
@@ -241,6 +242,7 @@ void ui_inp_history_append(char *inp);
|
||||
void cons_show(const char * const msg, ...);
|
||||
void cons_about(void);
|
||||
void cons_help(void);
|
||||
void cons_show_help(Command *command);
|
||||
void cons_navigation_help(void);
|
||||
void cons_prefs(void);
|
||||
void cons_show_ui_prefs(void);
|
||||
|
||||
Reference in New Issue
Block a user