(&self)
| 147 | |
| 148 | impl Command for IntentUpdate { |
| 149 | fn run(&self) -> CliResult<()> { |
| 150 | self.bind_work_start()?; |
| 151 | if crate::commands::rpc::intent_update(self)? { |
| 152 | return Ok(()); |
| 153 | } |
| 154 | |
| 155 | let root = find_repository_root()?; |
| 156 | let repo = crate::commands::open_repository_with_vault(&root)?; |
| 157 | |
| 158 | let content = self.resolve_body()?; |
| 159 | if self.status.is_none() |
| 160 | && self.assignee.is_none() |
| 161 | && self.priority.is_none() |
| 162 | && self.title.is_none() |
| 163 | && self.reason.is_none() |
| 164 | && self.informed_by.is_empty() |
| 165 | && content.is_none() |
| 166 | { |
| 167 | return Err(CliError::InvalidArgument { |
| 168 | message: "Nothing to update. Provide at least one of \ |
| 169 | --status, --assignee, --priority, --title, --reason, \ |
| 170 | --informed-by, \ |
| 171 | --body, or --body-stdin." |
| 172 | .to_string(), |
| 173 | }); |
| 174 | } |
| 175 | |
| 176 | let body_updated = content.is_some(); |
| 177 | let info = repo |
| 178 | .vault_intent_update( |
| 179 | &self.id, |
| 180 | IntentUpdateOptions { |
| 181 | status: self.status.clone(), |
| 182 | assignee: self.assignee.clone(), |
| 183 | priority: self.priority.clone(), |
| 184 | title: self.title.clone(), |
| 185 | informed_by: (!self.informed_by.is_empty()).then(|| self.informed_by.clone()), |
| 186 | content, |
| 187 | reason: self.reason.clone(), |
| 188 | force: self.force, |
| 189 | }, |
| 190 | ) |
| 191 | .map_err(CliError::Repository)?; |
| 192 | |
| 193 | println!("Updated intent: {}", info.id); |
| 194 | println!(" status: {}", info.status); |
| 195 | println!(" priority: {}", info.priority); |
| 196 | if let Some(ref assignee) = info.assignee { |
| 197 | println!(" assignee: {}", assignee); |
| 198 | } |
| 199 | if body_updated { |
| 200 | println!(" body: updated"); |
| 201 | } |
| 202 | if !self.informed_by.is_empty() { |
| 203 | println!(" informed by: {} source(s)", self.informed_by.len()); |
| 204 | } |
| 205 | |
| 206 | Ok(()) |
nothing calls this directly
no test coverage detected