| 69 | |
| 70 | impl Command for Show { |
| 71 | fn run(&self) -> CliResult<()> { |
| 72 | // Route every form through the service layer: the wire carries the |
| 73 | // full tag record plus the ReviewGate per-record presence the local |
| 74 | // render reads from the repository. |
| 75 | if crate::commands::rpc::tag_show(self)? { |
| 76 | return Ok(()); |
| 77 | } |
| 78 | |
| 79 | // Get the tag name |
| 80 | let name = self |
| 81 | .name |
| 82 | .as_ref() |
| 83 | .ok_or_else(|| CliError::InvalidArgument { |
| 84 | message: "Tag name is required".to_string(), |
| 85 | })?; |
| 86 | |
| 87 | // Find the repository |
| 88 | let repo_root = find_repository_root()?; |
| 89 | let mut repo = Repository::open_readonly(&repo_root).map_err(|e| match e { |
| 90 | atomic_repository::RepositoryError::NotFound { path } => CliError::RepositoryNotFound { |
| 91 | searched_path: path.into(), |
| 92 | }, |
| 93 | other => CliError::Repository(other), |
| 94 | })?; |
| 95 | |
| 96 | let workspace = enter_workspace(&mut repo, WorkspaceTxnMode::Observe)?; |
| 97 | |
| 98 | // Get the tag |
| 99 | let tag = repo |
| 100 | .get_tag_from_view(name, &workspace.view().name) |
| 101 | .map_err(CliError::Repository)?; |
| 102 | |
| 103 | match tag { |
| 104 | Some(tag) => { |
| 105 | println!("{}: {}", emphasis("Tag"), tag.name); |
| 106 | println!("{}: {}", emphasis("View"), tag.view); |
| 107 | println!("{}: {}", emphasis("Sequence"), tag.sequence); |
| 108 | println!("{}: {}", emphasis("State"), tag.state.to_base32()); |
| 109 | println!( |
| 110 | "{}: {}", |
| 111 | emphasis("Created"), |
| 112 | tag.timestamp.format("%Y-%m-%d %H:%M:%S UTC") |
| 113 | ); |
| 114 | println!("{}: {}", emphasis("Kind"), tag.kind); |
| 115 | println!( |
| 116 | "{}: {}", |
| 117 | emphasis("Type"), |
| 118 | if tag.is_annotated() { |
| 119 | "annotated" |
| 120 | } else { |
| 121 | "lightweight" |
| 122 | } |
| 123 | ); |
| 124 | |
| 125 | if let Some(ref message) = tag.message { |
| 126 | println!("{}: {}", emphasis("Message"), message); |
| 127 | } |
| 128 | |