workspacer_cli/coverage.rs
1// ---------------- [ File: workspacer-cli/src/coverage.rs ]
2crate::ix!();
3
4// 2) Now define the CoverageSubcommand with two variants: Crate(...) & Workspace(...)
5// We'll implement the subcommand with typical "run()" pattern:
6// - For crate coverage => find the crate => run coverage for that crate only
7// - For workspace coverage => call `ws.run_tests_with_coverage()`
8//
9#[derive(Debug, StructOpt)]
10pub enum CoverageSubcommand {
11 /// Run test coverage for a single crate
12 #[structopt(name = "crate")]
13 Crate(CoverageCrateCommand),
14
15 /// Run test coverage for the entire workspace
16 #[structopt(name = "workspace")]
17 Workspace(CoverageWorkspaceCommand),
18}
19
20impl CoverageSubcommand {
21 pub async fn run(&self) -> Result<(), WorkspaceError> {
22 match self {
23 CoverageSubcommand::Crate(cmd) => cmd.run().await,
24 CoverageSubcommand::Workspace(cmd) => cmd.run().await,
25 }
26 }
27}