(&self)
| 72 | |
| 73 | impl Command for IntentUpdate { |
| 74 | fn run(&self) -> CliResult<()> { |
| 75 | let root = find_repository_root()?; |
| 76 | let repo = Repository::open(&root).map_err(CliError::Repository)?; |
| 77 | |
| 78 | let content = self.resolve_body()?; |
| 79 | if self.status.is_none() |
| 80 | && self.assignee.is_none() |
| 81 | && self.priority.is_none() |
| 82 | && self.title.is_none() |
| 83 | && content.is_none() |
| 84 | { |
| 85 | return Err(CliError::InvalidArgument { |
| 86 | message: "Nothing to update. Provide at least one of \ |
| 87 | --status, --assignee, --priority, --title, --body, \ |
| 88 | or --body-stdin." |
| 89 | .to_string(), |
| 90 | }); |
| 91 | } |
| 92 | |
| 93 | let body_updated = content.is_some(); |
| 94 | let info = repo |
| 95 | .vault_intent_update( |
| 96 | &self.id, |
| 97 | IntentUpdateOptions { |
| 98 | status: self.status.clone(), |
| 99 | assignee: self.assignee.clone(), |
| 100 | priority: self.priority.clone(), |
| 101 | title: self.title.clone(), |
| 102 | content, |
| 103 | force: self.force, |
| 104 | }, |
| 105 | ) |
| 106 | .map_err(CliError::Repository)?; |
| 107 | |
| 108 | println!("Updated intent: {}", info.id); |
| 109 | println!(" status: {}", info.status); |
| 110 | println!(" priority: {}", info.priority); |
| 111 | if let Some(ref assignee) = info.assignee { |
| 112 | println!(" assignee: {}", assignee); |
| 113 | } |
| 114 | if body_updated { |
| 115 | println!(" body: updated"); |
| 116 | } |
| 117 | |
| 118 | Ok(()) |
| 119 | } |
| 120 | } |
nothing calls this directly
no test coverage detected