static void info_command (char *arg, int from_tty) { printf_unfiltered (_("\"info\" must be followed by " "the name of an info command.\n")); help_list (infolist, "info ", -1, gdb_stdout); }
static void set_dcache_command (char *arg, int from_tty) { printf_unfiltered ( "\"set dcache\" must be followed by the name of a subcommand.\n"); help_list (dcache_set_list, "set dcache ", -1, gdb_stdout); }
static void maintenance_command (char *args, int from_tty) { printf_unfiltered (_("\"maintenance\" must be followed by " "the name of a maintenance command.\n")); help_list (maintenancelist, "maintenance ", all_commands, gdb_stdout); }
static void serial_set_cmd (char *args, int from_tty) { printf_unfiltered ("\"set serial\" must be followed " "by the name of a command.\n"); help_list (serial_set_cmdlist, "set serial ", all_commands, gdb_stdout); }
static void maintenance_info_command (char *arg, int from_tty) { printf_unfiltered (_("\"maintenance info\" must be followed " "by the name of an info command.\n")); help_list (maintenanceinfolist, "maintenance info ", -1, gdb_stdout); }
static void set_check (char *ignore, int from_tty) { printf_unfiltered ( "\"set check\" must be followed by the name of a check subcommand.\n"); help_list (setchecklist, "set check ", -1, gdb_stdout); }
static void maintenance_command(const char *args, int from_tty) { printf_unfiltered(_("\"maintenance\" must be followed by the name of a maintenance command.\n")); help_list(maintenancelist, "maintenance ", (enum command_class)-1, gdb_stdout); }
static void set_style (const char *arg, int from_tty) { printf_unfiltered (_("\"set style\" must be followed " "by an appropriate subcommand.\n")); help_list (style_set_list, "set style ", all_commands, gdb_stdout); }
static void tui_reg_command (char *args, int from_tty) { printf_unfiltered (_("\"tui reg\" must be followed by the name of a " "tui reg command.\n")); help_list (tuireglist, "tui reg ", all_commands, gdb_stdout); }
/* FIXME: add comment: */ static void binary_append_command(const char *cmd, int from_tty) { printf_unfiltered("\"append binary\" must be followed by a subcommand.\n"); help_list(binary_append_cmdlist, "append binary ", (enum command_class)-1, gdb_stdout); }
/* FIXME: add comment: */ static void tekhex_dump_command(const char *cmd, int from_tty) { printf_unfiltered("\"dump tekhex\" must be followed by a subcommand.\n"); help_list(tekhex_cmdlist, "dump tekhex ", (enum command_class)-1, gdb_stdout); }
static void macro_command (char *arg, int from_tty) { printf_unfiltered ("\"macro\" must be followed by the name of a macro command.\n"); help_list (macrolist, "macro ", all_commands, gdb_stdout); }
gboolean cli_help (cli_context_t *ctx, command_t *cmd) { cmd_type_t cmdtype; GList *names; gint num_args; gboolean alias; num_args = command_arg_count (cmd); if (command_flag_boolean_get (cmd, "alias", &alias) && alias) { names = cli_context_alias_names (ctx); cmdtype = CMD_TYPE_ALIAS; } else { names = cli_context_command_names (ctx); cmdtype = CMD_TYPE_COMMAND; } /* No argument, display the list of commands */ if (num_args == 0) { help_list (names, NULL, cmdtype); } else { help_command (ctx, names, command_argv_get (cmd), num_args, cmdtype); } /* No data pending */ return FALSE; }
static void info_guile_command (char *args, int from_tty) { printf_unfiltered (_("\"info guile\" must be followed" " by the name of an info command.\n")); help_list (info_guile_list, "info guile ", -1, gdb_stdout); }
static void maintenance_check_command (const char *arg, int from_tty) { printf_unfiltered (_("\"maintenance check\" must be followed " "by the name of a check command.\n")); help_list (maintenancechecklist, "maintenance check ", all_commands, gdb_stdout); }
void help_command (cli_context_t *ctx, GList *cmdnames, gchar **cmd, gint num_args, cmd_type_t cmdtype) { command_action_t *action; command_trie_match_type_t match; gint i, k; gint padding, max_flag_len = 0; match = cli_context_find_command (ctx, &cmd, &num_args, &action); if (match == COMMAND_TRIE_MATCH_ACTION) { g_printf (_("usage: %s"), action->name); if (action->usage) { g_printf (" %s", action->usage); } g_printf ("\n\n"); print_indented (action->description, COMMAND_HELP_DESCRIPTION_INDENT); g_printf ("\n\n"); if (action->argdefs && action->argdefs[0].long_name) { /* Find length of longest option */ for (i = 0; action->argdefs[i].long_name; ++i) { if (max_flag_len < strlen (action->argdefs[i].long_name)) { max_flag_len = strlen (action->argdefs[i].long_name); } } g_printf (_("Valid options:\n")); for (i = 0; action->argdefs[i].long_name; ++i) { padding = max_flag_len - strlen (action->argdefs[i].long_name) + 2; if (action->argdefs[i].short_name) { g_printf (" -%c, ", action->argdefs[i].short_name); } else { g_printf (" "); } g_printf ("--%s", action->argdefs[i].long_name); for (k = 0; k < padding; ++k) { g_printf (" "); } g_printf ("%s\n", action->argdefs[i].description); /* FIXME: align multi-line */ } } } else if (match == COMMAND_TRIE_MATCH_SUBTRIE) { help_list (cmdnames, action->name, cmdtype); } else { /* FIXME: Better handle help for subcommands! */ g_printf (_("Unknown command: '")); for (i = 0; i < num_args; ++i) { if (i > 0) g_printf (" "); g_printf ("%s", cmd[i]); } g_printf (_("'\n")); g_printf (_("Type 'help' for the list of commands.\n")); } }
void help(char *command) { if(!command) help_ls(); else if(!strcmp(command, "help" )) help_help(); else if(!strcmp(command, "prompt" )) help_prompt(); else if(!strcmp(command, "init" )) help_init(); else if(!strcmp(command, "drop" )) help_drop(); else if(!strcmp(command, "create-service")) help_create_service(); else if(!strcmp(command, "list" )) help_list(); else if(!strcmp(command, "switch" )) help_switch(); else if(!strcmp(command, "back" )) help_back(); else if(!strcmp(command, "book" )) help_book(); else if(!strcmp(command, "service" )) help_service(); else if(!strcmp(command, "bill" )) help_bill(); else if(!strcmp(command, "checkout" )) help_checkout(); else error_print("Unknown command!"); }
int cmd_help(int argc, char *argv[]) { FILE *output = stdout; int res = EXIT_SUCCESS; if (strcmp(argv[0], "help_err") == 0) { output = stderr; res = EXIT_FAILURE; } if (argc == 1) { help(output); return res; } if (strcmp(argv[1], "backup") == 0) help_backup(output); else if (strcmp(argv[1], "restore") == 0) help_restore(output); else if (strcmp(argv[1], "delete") == 0) help_delete(output); else if (strcmp(argv[1], "list") == 0) help_list(output); else if (strcmp(argv[1], "help") == 0) help_help(output); else { int help_argc = 2; char *help_argv[] = { "help_err", "help", NULL }; return cmd_help(help_argc, help_argv); } return res; }
static void set_guile_command (char *args, int from_tty) { help_list (set_guile_list, "set guile ", all_commands, gdb_stdout); }
/* FIXME: add comment: */ static void append_command(const char *cmd, int from_tty) { printf_unfiltered(_("\"append\" must be followed by a subcommand.\n\n")); help_list(dump_cmdlist, "append ", (enum command_class)-1, gdb_stdout); }