Path: blob/main/contrib/llvm-project/lldb/source/Commands/CommandObjectHelp.h
39587 views
//===-- CommandObjectHelp.h -------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H9#define LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H1011#include "lldb/Host/OptionParser.h"12#include "lldb/Interpreter/CommandObject.h"13#include "lldb/Interpreter/Options.h"1415namespace lldb_private {1617// CommandObjectHelp1819class CommandObjectHelp : public CommandObjectParsed {20public:21CommandObjectHelp(CommandInterpreter &interpreter);2223~CommandObjectHelp() override;2425void HandleCompletion(CompletionRequest &request) override;2627static void GenerateAdditionalHelpAvenuesMessage(28Stream *s, llvm::StringRef command, llvm::StringRef prefix,29llvm::StringRef subcommand, bool include_upropos = true,30bool include_type_lookup = true);3132class CommandOptions : public Options {33public:34CommandOptions() = default;3536~CommandOptions() override = default;3738Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,39ExecutionContext *execution_context) override {40Status error;41const int short_option = m_getopt_table[option_idx].val;4243switch (short_option) {44case 'a':45m_show_aliases = false;46break;47case 'u':48m_show_user_defined = false;49break;50case 'h':51m_show_hidden = true;52break;53default:54llvm_unreachable("Unimplemented option");55}5657return error;58}5960void OptionParsingStarting(ExecutionContext *execution_context) override {61m_show_aliases = true;62m_show_user_defined = true;63m_show_hidden = false;64}6566llvm::ArrayRef<OptionDefinition> GetDefinitions() override;6768// Instance variables to hold the values for command options.6970bool m_show_aliases;71bool m_show_user_defined;72bool m_show_hidden;73};7475Options *GetOptions() override { return &m_options; }7677protected:78void DoExecute(Args &command, CommandReturnObject &result) override;7980private:81CommandOptions m_options;82};8384} // namespace lldb_private8586#endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTHELP_H878889