1crate::ix!();
3
4#[derive(Debug, StructOpt)]
5pub enum ShowSubcommand {
6 #[structopt(name = "crate")]
8 Crate(ShowFlags),
9
10 #[structopt(name = "crate-tree")]
13 CrateTree(ShowFlags),
14
15 #[structopt(name = "workspace")]
17 Workspace(ShowFlags),
18}
19
20impl ShowSubcommand {
21 #[tracing::instrument(level = "trace", skip(self))]
27 pub async fn run(&self) -> Result<(), WorkspaceError> {
28 trace!("Entering ShowSubcommand::run");
29 let mut final_output = String::new();
30
31 match self {
32 ShowSubcommand::Crate(flags) => {
33 let out = show_crate(flags).await?;
34 final_output.push_str(&out);
35 }
36 ShowSubcommand::CrateTree(flags) => {
37 let out = show_crate_tree(flags).await?;
38 final_output.push_str(&out);
39 }
40 ShowSubcommand::Workspace(flags) => {
41 let out = show_workspace(flags).await?;
42 final_output.push_str(&out);
43 }
44 }
45
46 if final_output.trim().is_empty() {
47 trace!("No data produced in ShowSubcommand::run");
48 } else {
49 println!("{}", final_output);
50 }
51
52 Ok(())
53 }
54}