workspacer_cli/
add.rs

1// ---------------- [ File: workspacer-cli/src/add.rs ]
2crate::ix!();
3
4#[derive(Debug,StructOpt)]
5pub enum AddSubcommand {
6    /// Add a new crate to the workspace
7    #[structopt(name = "crate")]
8    Crate(AddCrateCommand),
9
10    /// Add an internal dependency (target-crate depends on dep-crate)
11    #[structopt(name = "internal-dep")]
12    InternalDep(AddInternalDepCommand),
13}
14
15/// Next, in your `AddSubcommand::run` method (where the lifetime error appeared),
16/// simply clone the `crate_name` to pass as owned `String` to the helper.
17impl AddSubcommand {
18    pub async fn run(&self) -> Result<(), WorkspaceError> {
19        trace!("Entering AddSubcommand::run with {:?}", self);
20
21        match self {
22            AddSubcommand::Crate(cmd) => { cmd.run().await? }
23            AddSubcommand::InternalDep(cmd)  => { cmd.run().await? }
24        }
25
26        Ok(())
27    }
28}