Skip to content

Commit 7907e6e

Browse files
committed
Clean up cvd help, remove deprecated commands, and refactor
- Hide irrelevant commands in cvd help by default. - Delete noop.cpp and noop.h (removing kill-server, server-kill, restart-server). - Clean up help strings and TopLevelHelp logic in help.cpp. Output without a running device: ================================ ``` Cuttlefish Virtual Device (CVD) CLI. usage: cvd <selector/driver options> <command> <args> Driver Options: -help Print this message -verbosity=<LEVEL> Adjust Cvd verbosity level. LEVEL is Android log severity. (Required: cvd >= v1.3) Commands (cvd help <command> for more information): cache - Manage the files cached by cvd create - Create a Cuttlefish virtual device or environment fetch, fetch_cvd - Retrieve build artifacts based on branch and target names help - Used to display help information for other commands lint - error checks the input virtual device json config file load - Loads the given JSON configuration file and launches devices based on the options provided login - Acquire credentials reset - Used to stop devices, optionally clean up instance files, and shut down the deprecated cvd server process version - Prints version of cvd client and cvd server ``` Output with a running device: ============================= ``` Cuttlefish Virtual Device (CVD) CLI. usage: cvd <selector/driver options> <command> <args> Driver Options: -help Print this message -verbosity=<LEVEL> Adjust Cvd verbosity level. LEVEL is Android log severity. (Required: cvd >= v1.3) Commands (cvd help <command> for more information): cache - Manage the files cached by cvd create - Create a Cuttlefish virtual device or environment fetch, fetch_cvd - Retrieve build artifacts based on branch and target names help - Used to display help information for other commands lint - error checks the input virtual device json config file load - Loads the given JSON configuration file and launches devices based on the options provided login - Acquire credentials reset - Used to stop devices, optionally clean up instance files, and shut down the deprecated cvd server process version - Prints version of cvd client and cvd server Selector Options: -group_name <name> Specify the name of the instance group created or selected. -instance_name <name> Selects the device of the given name to perform the commands for. -instance_name <names> Takes the names of the devices to create within an instance group. The 'names' is comma-separated. Device-Specific Commands (cvd help <command> for more information): display - Enables hotplug/unplug of displays from running cuttlefish virtual devices env - Enumerate + Query APIs for all gRPC services made available by this virtual device instance fleet - lists active devices with relevant information clear - Clears the instance database, stopping any running instances first. bugreport, host_bugreport, cvd_host_bugreport - Run cvd bugreport --help for command description stop, stop_cvd - Stop all instances in a group powerbtn - Trigger power button event on the device powerwash - Reset device to first boot state restart - Restart device remove, rm - Remove devices and artifacts from the system. screen_recording - Record screen contents suspend, resume, snapshot_take - Suspend/resume the cuttlefish device, or take snapshot of the device start, launch_cvd - Start a Cuttlefish virtual device or environment status, cvd_status - Query status of a single instance group. Use `cvd fleet` for all devices ``` Assisted-by: Gemini:Next Bug: b/504758273
1 parent 758b916 commit 7907e6e

25 files changed

Lines changed: 84 additions & 248 deletions

base/cvd/cuttlefish/host/commands/cvd/cli/BUILD.bazel

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,13 @@ cf_cc_library(
5757
srcs = [
5858
"command_sequence.cpp",
5959
"request_context.cpp",
60-
"//cuttlefish/host/commands/cvd/cli/commands:cmd_list.cpp",
6160
"//cuttlefish/host/commands/cvd/cli/commands:create.cpp",
6261
"//cuttlefish/host/commands/cvd/cli/commands:help.cpp",
6362
"//cuttlefish/host/commands/cvd/cli/commands:load_configs.cpp",
6463
],
6564
hdrs = [
6665
"command_sequence.h",
6766
"request_context.h",
68-
"//cuttlefish/host/commands/cvd/cli/commands:cmd_list.h",
6967
"//cuttlefish/host/commands/cvd/cli/commands:create.h",
7068
"//cuttlefish/host/commands/cvd/cli/commands:help.h",
7169
"//cuttlefish/host/commands/cvd/cli/commands:load_configs.h",
@@ -91,7 +89,6 @@ cf_cc_library(
9189
"//cuttlefish/host/commands/cvd/cli/commands:host_tool_target",
9290
"//cuttlefish/host/commands/cvd/cli/commands:lint",
9391
"//cuttlefish/host/commands/cvd/cli/commands:login",
94-
"//cuttlefish/host/commands/cvd/cli/commands:noop",
9592
"//cuttlefish/host/commands/cvd/cli/commands:power_btn",
9693
"//cuttlefish/host/commands/cvd/cli/commands:powerwash",
9794
"//cuttlefish/host/commands/cvd/cli/commands:remove",

base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ package(
66

77
exports_files([
88
".clang-tidy",
9-
"cmd_list.cpp",
10-
"cmd_list.h",
119
"create.cpp",
1210
"create.h",
1311
"help.cpp",
@@ -218,19 +216,6 @@ cf_cc_library(
218216
],
219217
)
220218

221-
cf_cc_library(
222-
name = "noop",
223-
srcs = ["noop.cpp"],
224-
hdrs = ["noop.h"],
225-
deps = [
226-
"//cuttlefish/host/commands/cvd/cli:command_request",
227-
"//cuttlefish/host/commands/cvd/cli:types",
228-
"//cuttlefish/host/commands/cvd/cli/commands:command_handler",
229-
"//cuttlefish/result",
230-
"@fmt",
231-
],
232-
)
233-
234219
cf_cc_library(
235220
name = "power_btn",
236221
srcs = ["power_btn.cpp"],

base/cvd/cuttlefish/host/commands/cvd/cli/commands/bugreport.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class CvdBugreportCommandHandler : public CvdCommandHandler {
9898
cvd_common::Args CmdList() const override;
9999
Result<std::string> SummaryHelp() const override;
100100
bool ShouldInterceptHelp() const override;
101+
bool RequiresDeviceExists() const override;
101102
Result<std::string> DetailedHelp(std::vector<std::string>&) const override;
102103

103104
private:
@@ -187,6 +188,7 @@ Result<std::string> CvdBugreportCommandHandler::SummaryHelp() const {
187188
}
188189

189190
bool CvdBugreportCommandHandler::ShouldInterceptHelp() const { return false; }
191+
bool CvdBugreportCommandHandler::RequiresDeviceExists() const { return true; }
190192

191193
Result<std::string> CvdBugreportCommandHandler::DetailedHelp(
192194
std::vector<std::string>& arguments) const {

base/cvd/cuttlefish/host/commands/cvd/cli/commands/clear.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class CvdClearCommandHandler : public CvdCommandHandler {
4141
cvd_common::Args CmdList() const override { return {kClearCmd}; }
4242
Result<std::string> SummaryHelp() const override { return kSummaryHelpText; }
4343
bool ShouldInterceptHelp() const override { return true; }
44+
bool RequiresDeviceExists() const override { return true; }
4445
Result<std::string> DetailedHelp(std::vector<std::string>&) const override;
4546

4647
private:

base/cvd/cuttlefish/host/commands/cvd/cli/commands/cmd_list.cpp

Lines changed: 0 additions & 74 deletions
This file was deleted.

base/cvd/cuttlefish/host/commands/cvd/cli/commands/cmd_list.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

base/cvd/cuttlefish/host/commands/cvd/cli/commands/command_handler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ Result<bool> CvdCommandHandler::CanHandle(const CommandRequest& request) const {
2626
return Contains(CmdList(), request.Subcommand());
2727
}
2828

29+
bool CvdCommandHandler::RequiresDeviceExists() const { return false; }
30+
2931
} // namespace cuttlefish

base/cvd/cuttlefish/host/commands/cvd/cli/commands/command_handler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class CvdCommandHandler {
3535
virtual cvd_common::Args CmdList() const = 0;
3636
// used for command help text
3737
virtual Result<std::string> SummaryHelp() const = 0;
38+
virtual bool RequiresDeviceExists() const;
3839
virtual bool ShouldInterceptHelp() const = 0;
3940
virtual Result<std::string> DetailedHelp(std::vector<std::string>&) const = 0;
4041
};

base/cvd/cuttlefish/host/commands/cvd/cli/commands/display.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ class CvdDisplayCommandHandler : public CvdCommandHandler {
9191

9292
bool ShouldInterceptHelp() const override { return true; }
9393

94+
bool RequiresDeviceExists() const override { return true; }
95+
9496
Result<std::string> DetailedHelp(std::vector<std::string>&) const override {
9597
return kDetailedHelpText;
9698
}

base/cvd/cuttlefish/host/commands/cvd/cli/commands/env.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ class CvdEnvCommandHandler : public CvdCommandHandler {
8989

9090
bool ShouldInterceptHelp() const override { return true; }
9191

92+
bool RequiresDeviceExists() const override { return true; }
93+
9294
Result<std::string> DetailedHelp(std::vector<std::string>&) const override {
9395
return kDetailedHelpText;
9496
}

0 commit comments

Comments
 (0)