workspacer_cli/
check_publish_ready.rs

1// ---------------- [ File: workspacer-cli/src/check_publish_ready.rs ]
2crate::ix!();
3
4/// We’ll extend `CheckPublishReadySubcommand` to have two variants:
5///   - Crate => check just one crate
6///   - Workspace => check all crates in the workspace
7///
8/// Then, for each variant, we define a small struct that implements a `.run()` method,
9/// which uses the library trait `ReadyForCargoPublish` on either the crate handle or 
10/// the entire workspace.
11
12/// First, define the two variants.
13#[derive(Debug, StructOpt)]
14pub enum CheckPublishReadySubcommand {
15    /// Check if a single crate is ready for publishing
16    #[structopt(name = "crate")]
17    Crate(CheckPublishReadyCrateCommand),
18
19    /// Check if the entire workspace is ready for publishing
20    #[structopt(name = "workspace")]
21    Workspace(CheckPublishReadyWorkspaceCommand),
22}
23
24impl CheckPublishReadySubcommand {
25    pub async fn run(&self) -> Result<(), WorkspaceError> {
26        match self {
27            CheckPublishReadySubcommand::Crate(cmd) => cmd.run().await,
28            CheckPublishReadySubcommand::Workspace(cmd) => cmd.run().await,
29        }
30    }
31}