1 //===-- CommandObjectHelp.h -------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H
10 #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H
12 #include "lldb/Host/OptionParser.h"
13 #include "lldb/Interpreter/CommandObject.h"
14 #include "lldb/Interpreter/Options.h"
16 namespace lldb_private
{
20 class CommandObjectHelp
: public CommandObjectParsed
{
22 CommandObjectHelp(CommandInterpreter
&interpreter
);
24 ~CommandObjectHelp() override
;
26 void HandleCompletion(CompletionRequest
&request
) override
;
28 static void GenerateAdditionalHelpAvenuesMessage(
29 Stream
*s
, llvm::StringRef command
, llvm::StringRef prefix
,
30 llvm::StringRef subcommand
, bool include_upropos
= true,
31 bool include_type_lookup
= true);
33 class CommandOptions
: public Options
{
35 CommandOptions() = default;
37 ~CommandOptions() override
= default;
39 Status
SetOptionValue(uint32_t option_idx
, llvm::StringRef option_arg
,
40 ExecutionContext
*execution_context
) override
{
42 const int short_option
= m_getopt_table
[option_idx
].val
;
44 switch (short_option
) {
46 m_show_aliases
= false;
49 m_show_user_defined
= false;
55 llvm_unreachable("Unimplemented option");
61 void OptionParsingStarting(ExecutionContext
*execution_context
) override
{
62 m_show_aliases
= true;
63 m_show_user_defined
= true;
64 m_show_hidden
= false;
67 llvm::ArrayRef
<OptionDefinition
> GetDefinitions() override
;
69 // Instance variables to hold the values for command options.
72 bool m_show_user_defined
;
76 Options
*GetOptions() override
{ return &m_options
; }
79 void DoExecute(Args
&command
, CommandReturnObject
&result
) override
;
82 CommandOptions m_options
;
85 } // namespace lldb_private
87 #endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H