diff options
author | Enrico Granata <egranata@apple.com> | 2016-02-29 23:22:53 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2016-02-29 23:22:53 +0000 |
commit | 46d4aa211ff9e84d8f71aafe818804758133b8aa (patch) | |
tree | e0b3359f9b1e2d1ea78ec80b81e23675eb4e245f /lldb/source/Commands/CommandObjectSyntax.cpp | |
parent | efc091f457c98ecf86498fe0fd45c81a58d4a2ab (diff) | |
download | bcm5719-llvm-46d4aa211ff9e84d8f71aafe818804758133b8aa.tar.gz bcm5719-llvm-46d4aa211ff9e84d8f71aafe818804758133b8aa.zip |
When 'help' cannot find a command, produce additional help text that also points the user to the apropos and type lookup commands
This is useful in cases such as, e.g.
(lldb) help NSString
(the user meant type lookup)
or
(lldb) help kill
(the user is looking for process kill)
Fixes rdar://24868537
llvm-svn: 262271
Diffstat (limited to 'lldb/source/Commands/CommandObjectSyntax.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectSyntax.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectSyntax.cpp b/lldb/source/Commands/CommandObjectSyntax.cpp index 12bfce3c292..c238bccfb5d 100644 --- a/lldb/source/Commands/CommandObjectSyntax.cpp +++ b/lldb/source/Commands/CommandObjectSyntax.cpp @@ -12,6 +12,7 @@ // Other libraries and framework includes // Project includes #include "CommandObjectSyntax.h" +#include "CommandObjectHelp.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -97,8 +98,17 @@ CommandObjectSyntax::DoExecute (Args& command, CommandReturnObject &result) { std::string cmd_string; command.GetCommandString (cmd_string); - result.AppendErrorWithFormat ("'%s' is not a known command.\n", cmd_string.c_str()); - result.AppendError ("Try 'help' to see a current list of commands."); + + StreamString error_msg_stream; + const bool generate_apropos = true; + const bool generate_type_lookup = false; + CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(&error_msg_stream, + cmd_string.c_str(), + nullptr, + nullptr, + generate_apropos, + generate_type_lookup); + result.AppendErrorWithFormat ("%s", error_msg_stream.GetData()); result.SetStatus (eReturnStatusFailed); } } |