diff options
Diffstat (limited to 'simpleperf/cmd_help.cpp')
-rw-r--r-- | simpleperf/cmd_help.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/simpleperf/cmd_help.cpp b/simpleperf/cmd_help.cpp index b51071b2..1c8cd631 100644 --- a/simpleperf/cmd_help.cpp +++ b/simpleperf/cmd_help.cpp @@ -22,6 +22,9 @@ #include "command.h" +namespace simpleperf { +namespace { + class HelpCommand : public Command { public: HelpCommand() @@ -31,7 +34,7 @@ class HelpCommand : public Command { " Without subcommand, print short help string for every subcommand.\n" " With subcommand, print long help string for the subcommand.\n\n" // clang-format on - ) {} + ) {} bool Run(const std::vector<std::string>& args) override; @@ -73,7 +76,7 @@ void HelpCommand::PrintShortHelp() { " --version Print version of simpleperf.\n" "subcommands:\n" // clang-format on - ); + ); for (auto& cmd_name : GetAllCommandNames()) { std::unique_ptr<Command> cmd = CreateCommandInstance(cmd_name); printf(" %-20s%s\n", cmd_name.c_str(), cmd->ShortHelpString().c_str()); @@ -84,7 +87,10 @@ void HelpCommand::PrintLongHelpForOneCommand(const Command& command) { printf("%s\n", command.LongHelpString().c_str()); } +} // namespace + void RegisterHelpCommand() { - RegisterCommand("help", - [] { return std::unique_ptr<Command>(new HelpCommand); }); + RegisterCommand("help", [] { return std::unique_ptr<Command>(new HelpCommand); }); } + +} // namespace simpleperf |