diff options
author | Enrico Granata <granata.enrico@gmail.com> | 2011-09-09 17:49:36 +0000 |
---|---|---|
committer | Enrico Granata <granata.enrico@gmail.com> | 2011-09-09 17:49:36 +0000 |
commit | 08633eea20c2c329b8fd05681bfed1068b2e8363 (patch) | |
tree | bd22d28db399ae0fbdc7670b93843ec730551ae5 /lldb/source/Commands/CommandObjectHelp.cpp | |
parent | 8a8ce4ad2f0fe5e4d8e891515a7b915dc6e31eaf (diff) | |
download | bcm5719-llvm-08633eea20c2c329b8fd05681bfed1068b2e8363.tar.gz bcm5719-llvm-08633eea20c2c329b8fd05681bfed1068b2e8363.zip |
Adding two new options to the 'help' command:
--show-aliases (-a) shows aliases for commands, as well as built-in commands
--hide-user-defined (-u) hides user defined commands
by default 'help' without arguments does not show aliases anymore. to see them, add --show-aliases
to have only built-in commands appear, use 'help --hide-user-defined' ; there is currently no way to hide
built-in commands from the help output
'help command' is not changed by this commit, and help is shown even if command is an alias and -a is not specified
llvm-svn: 139377
Diffstat (limited to 'lldb/source/Commands/CommandObjectHelp.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectHelp.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp index 0c94ff262cb..dd68f7cd4f4 100644 --- a/lldb/source/Commands/CommandObjectHelp.cpp +++ b/lldb/source/Commands/CommandObjectHelp.cpp @@ -29,7 +29,7 @@ CommandObjectHelp::CommandObjectHelp (CommandInterpreter &interpreter) : CommandObject (interpreter, "help", "Show a list of all debugger commands, or give details about specific commands.", - "help [<cmd-name>]") + "help [<cmd-name>]"), m_options (interpreter) { CommandArgumentEntry arg; CommandArgumentData command_arg; @@ -49,6 +49,14 @@ CommandObjectHelp::~CommandObjectHelp() { } +OptionDefinition +CommandObjectHelp::CommandOptions::g_option_table[] = +{ + { LLDB_OPT_SET_ALL, false, "show-aliases", 'a', no_argument, NULL, 0, eArgTypeNone, "Show aliases in the command list."}, + { LLDB_OPT_SET_ALL, false, "hide-user-commands", 'u', no_argument, NULL, 0, eArgTypeNone, "Hide user-defined commands from the list."}, + { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } +}; + bool CommandObjectHelp::Execute (Args& command, CommandReturnObject &result) { @@ -56,12 +64,18 @@ CommandObjectHelp::Execute (Args& command, CommandReturnObject &result) CommandObject *cmd_obj; const int argc = command.GetArgumentCount (); - // 'help' doesn't take any options or arguments, other than command names. If argc is 0, we show the user - // all commands and aliases. Otherwise every argument must be the name of a command or a sub-command. + // 'help' doesn't take any arguments, other than command names. If argc is 0, we show the user + // all commands (aliases and user commands if asked for). Otherwise every argument must be the name of a command or a sub-command. if (argc == 0) { + uint32_t cmd_types = CommandInterpreter::eCommandTypesBuiltin; + if (m_options.m_show_aliases) + cmd_types |= CommandInterpreter::eCommandTypesAliases; + if (m_options.m_show_user_defined) + cmd_types |= CommandInterpreter::eCommandTypesUserDef; + result.SetStatus (eReturnStatusSuccessFinishNoResult); - m_interpreter.GetHelp (result); // General help, for ALL commands. + m_interpreter.GetHelp (result, cmd_types); // General help } else { |