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_
15 // Other libraries and framework includes
17 #include "lldb/Interpreter/CommandObject.h"
18 #include "lldb/Interpreter/Options.h"
20 namespace lldb_private {
22 //-------------------------------------------------------------------------
24 //-------------------------------------------------------------------------
26 class CommandObjectHelp : public CommandObjectParsed {
28 CommandObjectHelp(CommandInterpreter &interpreter);
30 ~CommandObjectHelp() override;
32 int HandleCompletion(Args &input, int &cursor_index,
33 int &cursor_char_position, int match_start_point,
34 int max_return_elements, bool &word_complete,
35 StringList &matches) override;
37 static void GenerateAdditionalHelpAvenuesMessage(
38 Stream *s, llvm::StringRef command, llvm::StringRef prefix,
39 llvm::StringRef subcommand, bool include_apropos = true,
40 bool include_type_lookup = true);
42 class CommandOptions : public Options {
44 CommandOptions() : Options() {}
46 ~CommandOptions() override {}
48 Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
49 ExecutionContext *execution_context) override {
51 const int short_option = m_getopt_table[option_idx].val;
53 switch (short_option) {
55 m_show_aliases = false;
58 m_show_user_defined = false;
64 error.SetErrorStringWithFormat("unrecognized option '%c'",
72 void OptionParsingStarting(ExecutionContext *execution_context) override {
73 m_show_aliases = true;
74 m_show_user_defined = true;
75 m_show_hidden = false;
78 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
80 // Instance variables to hold the values for command options.
83 bool m_show_user_defined;
87 Options *GetOptions() override { return &m_options; }
90 bool DoExecute(Args &command, CommandReturnObject &result) override;
93 CommandOptions m_options;
96 } // namespace lldb_private
98 #endif // liblldb_CommandObjectHelp_h_