const char *help_str;
if (full_help) {
- help_str = "Perform configuration file test\n"
+ help_str = "Perform configuration file test\n\n"
"Usage: rspamadm configtest [-q -c <config_name>]\n"
- "Where options are:\n"
- "-q quiet output\n"
- "-c config file to test\n"
+ "Where options are:\n\n"
+ "-q: quiet output\n"
+ "-c: config file to test\n"
"--help: shows available options and commands";
}
else {
const char *help_str;
if (full_help) {
- help_str = "Create key pairs for httpcrypt\n"
+ help_str = "Create key pairs for httpcrypt\n\n"
"Usage: rspamadm keypair [-x -r]\n"
- "Where options are:\n"
- "-x encode with hex instead of base32\n"
- "-r print raw base32/hex\n"
+ "Where options are:\n\n"
+ "-x: encode with hex instead of base32\n"
+ "-r: print raw base32/hex\n"
"--help: shows available options and commands";
}
else {
const char *help_str;
if (full_help) {
- help_str = "Manipulate with passwords in rspamd\n"
+ help_str = "Manipulate with passwords in rspamd\n\n"
"Usage: rspamadm pw [command]\n"
- "Where commands are:\n"
+ "Where commands are:\n\n"
"--encrypt: encrypt password (this is a default command)\n"
"--check: check encrypted password using encrypted password\n"
"--help: shows available options and commands";
rspamadm_version (void)
{
printf ("Rspamadm %s\n", RVERSION);
- exit (EXIT_SUCCESS);
}
static void
help_str = g_option_context_get_help (context, TRUE, NULL);
printf ("%s", help_str);
-
- exit (EXIT_SUCCESS);
}
static void
-rspamadm_commands (GOptionContext *context)
+rspamadm_commands ()
{
const struct rspamadm_command **cmd;
cmd = commands;
while (*cmd) {
- printf (" %-18s %-60s\n", (*cmd)->name, (*cmd)->help (FALSE));
+ if (!((*cmd)->flags & RSPAMADM_FLAG_NOHELP)) {
+ printf (" %-18s %-60s\n", (*cmd)->name, (*cmd)->help (FALSE));
+ }
cmd ++;
}
-
- exit (EXIT_SUCCESS);
}
static const char *
rspamadm_help (gint argc, gchar **argv)
{
const gchar *cmd_name;
- const struct rspamadm_command *cmd;
+ const struct rspamadm_command *cmd, **cmd_list;
+
+ printf ("Rspamadm %s\n", RVERSION);
+ printf ("Usage: rspamadm [global_options] command [command_options]\n\n");
- if (argc == 0) {
+ if (argc <= 1) {
cmd_name = "help";
}
else {
cmd_name = argv[1];
+ printf ("Showing help for %s command\n\n", cmd_name);
}
cmd = rspamadm_search_command (cmd_name);
exit (EXIT_FAILURE);
}
- printf ("%s\n", cmd->help (TRUE));
+ if (strcmp (cmd_name, "help") == 0) {
+ printf ("Available commands:\n");
+
+ cmd_list = commands;
+
+ while (*cmd_list) {
+ if (!((*cmd_list)->flags & RSPAMADM_FLAG_NOHELP)) {
+ printf (" %-18s %-60s\n", (*cmd_list)->name,
+ (*cmd_list)->help (FALSE));
+ }
+ cmd_list++;
+ }
+ }
+ else {
+ printf ("%s\n", cmd->help (TRUE));
+ }
}
static gboolean
if (show_version) {
rspamadm_version ();
+ exit (EXIT_SUCCESS);
}
if (show_help) {
rspamadm_usage (context);
+ exit (EXIT_SUCCESS);
}
if (list_commands) {
- rspamadm_commands (context);
+ rspamadm_commands ();
+ exit (EXIT_SUCCESS);
}
cmd_name = argv[nargc];