diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/command_request.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/command_request.cpp index d8d8f28d09..10742c5fad 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/command_request.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/command_request.cpp @@ -20,6 +20,7 @@ #include #include "common/libs/utils/files.h" +#include "common/libs/utils/flag_parser.h" #include "common/libs/utils/result.h" #include "host/commands/cvd/cli/command_request.h" #include "host/commands/cvd/cli/selector/selector_common_parser.h" @@ -44,6 +45,12 @@ CommandRequest::CommandRequest(cvd_common::Args args, cvd_common::Envs env, subcommand_ = subcommand_arguments_[0]; subcommand_arguments_.erase(subcommand_arguments_.begin()); } + + // transform `cvd -h` or `cvd --help` requests into `cvd help` + Result is_top_level_help_flag = HasHelpFlag({subcommand_}); + if (is_top_level_help_flag.ok() && *is_top_level_help_flag) { + subcommand_ = "help"; + } } CommandRequestBuilder& CommandRequestBuilder::AddArguments(