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/Host/OptionParser.h"
18 #include "lldb/Interpreter/CommandObject.h"
19 #include "lldb/Interpreter/Options.h"
21 namespace lldb_private {
23 //-------------------------------------------------------------------------
25 //-------------------------------------------------------------------------
27 class CommandObjectHelp : public CommandObjectParsed {
29 CommandObjectHelp(CommandInterpreter &interpreter);
31 ~CommandObjectHelp() override;
33 int HandleCompletion(Args &input, int &cursor_index,
34 int &cursor_char_position, int match_start_point,
35 int max_return_elements, bool &word_complete,
36 StringList &matches) override;
38 static void GenerateAdditionalHelpAvenuesMessage(
39 Stream *s, llvm::StringRef command, llvm::StringRef prefix,
40 llvm::StringRef subcommand, bool include_apropos = true,
41 bool include_type_lookup = true);
43 class CommandOptions : public Options {
45 CommandOptions() : Options() {}
47 ~CommandOptions() override {}
49 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
50 ExecutionContext *execution_context) override {
52 const int short_option = m_getopt_table[option_idx].val;
54 switch (short_option) {
56 m_show_aliases = false;
59 m_show_user_defined = false;
65 error.SetErrorStringWithFormat("unrecognized option '%c'",
73 void OptionParsingStarting(ExecutionContext *execution_context) override {
74 m_show_aliases = true;
75 m_show_user_defined = true;
76 m_show_hidden = false;
79 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
81 // Instance variables to hold the values for command options.
84 bool m_show_user_defined;
88 Options *GetOptions() override { return &m_options; }
91 bool DoExecute(Args &command, CommandReturnObject &result) override;
94 CommandOptions m_options;
97 } // namespace lldb_private
99 #endif // liblldb_CommandObjectHelp_h_