MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / run

Method run

atomic-cli/src/commands/intent/update.rs:257–315  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

255
256impl Command for IntentUpdate {
257 fn run(&self) -> CliResult<()> {
258 self.bind_work_start()?;
259 if crate::commands::rpc::intent_update(self)? {
260 return Ok(());
261 }
262
263 let root = find_repository_root()?;
264 let repo = crate::commands::open_repository_with_vault(&root)?;
265
266 let content = self.resolve_body()?;
267 if self.status.is_none()
268 && self.assignee.is_none()
269 && self.priority.is_none()
270 && self.title.is_none()
271 && self.reason.is_none()
272 && self.informed_by.is_empty()
273 && content.is_none()
274 {
275 return Err(CliError::InvalidArgument {
276 message: "Nothing to update. Provide at least one of \
277 --status, --assignee, --priority, --title, --reason, \
278 --informed-by, \
279 --body, or --body-stdin."
280 .to_string(),
281 });
282 }
283
284 let body_updated = content.is_some();
285 let info = repo
286 .vault_intent_update(
287 &self.id,
288 IntentUpdateOptions {
289 status: self.status.clone(),
290 assignee: self.assignee.clone(),
291 priority: self.priority.clone(),
292 title: self.title.clone(),
293 informed_by: (!self.informed_by.is_empty()).then(|| self.informed_by.clone()),
294 content,
295 reason: self.reason.clone(),
296 force: self.force,
297 },
298 )
299 .map_err(CliError::Repository)?;
300
301 println!("Updated intent: {}", info.id);
302 println!(" status: {}", info.status);
303 println!(" priority: {}", info.priority);
304 if let Some(ref assignee) = info.assignee {
305 println!(" assignee: {}", assignee);
306 }
307 if body_updated {
308 println!(" body: updated");
309 }
310 if !self.informed_by.is_empty() {
311 println!(" informed by: {} source(s)", self.informed_by.len());
312 }
313
314 Ok(())

Callers

nothing calls this directly

Calls 9

intent_updateFunction · 0.85
find_repository_rootFunction · 0.85
bind_work_startMethod · 0.80
resolve_bodyMethod · 0.80
is_noneMethod · 0.80
vault_intent_updateMethod · 0.80
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected