1 //===-- CommandObjectHelp.h -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_CommandObjectHelp_h_
11 #define liblldb_CommandObjectHelp_h_
13 #include "lldb/Host/OptionParser.h"
14 #include "lldb/Interpreter/CommandObject.h"
15 #include "lldb/Interpreter/Options.h"
17 namespace lldb_private {
19 //-------------------------------------------------------------------------
21 //-------------------------------------------------------------------------
23 class CommandObjectHelp : public CommandObjectParsed {
25 CommandObjectHelp(CommandInterpreter &interpreter);
27 ~CommandObjectHelp() override;
29 int HandleCompletion(CompletionRequest &request) override;
31 static void GenerateAdditionalHelpAvenuesMessage(
32 Stream *s, llvm::StringRef command, llvm::StringRef prefix,
33 llvm::StringRef subcommand, bool include_apropos = true,
34 bool include_type_lookup = true);
36 class CommandOptions : public Options {
38 CommandOptions() : Options() {}
40 ~CommandOptions() override {}
42 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
43 ExecutionContext *execution_context) override {
45 const int short_option = m_getopt_table[option_idx].val;
47 switch (short_option) {
49 m_show_aliases = false;
52 m_show_user_defined = false;
58 error.SetErrorStringWithFormat("unrecognized option '%c'",
66 void OptionParsingStarting(ExecutionContext *execution_context) override {
67 m_show_aliases = true;
68 m_show_user_defined = true;
69 m_show_hidden = false;
72 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
74 // Instance variables to hold the values for command options.
77 bool m_show_user_defined;
81 Options *GetOptions() override { return &m_options; }
84 bool DoExecute(Args &command, CommandReturnObject &result) override;
87 CommandOptions m_options;
90 } // namespace lldb_private
92 #endif // liblldb_CommandObjectHelp_h_