(&self)
| 81 | |
| 82 | impl Command for IntentUpdate { |
| 83 | fn run(&self) -> CliResult<()> { |
| 84 | let root = find_repository_root()?; |
| 85 | let repo = Repository::open(&root).map_err(CliError::Repository)?; |
| 86 | |
| 87 | let content = self.resolve_body()?; |
| 88 | if self.status.is_none() |
| 89 | && self.assignee.is_none() |
| 90 | && self.priority.is_none() |
| 91 | && self.title.is_none() |
| 92 | && self.reason.is_none() |
| 93 | && self.informed_by.is_empty() |
| 94 | && content.is_none() |
| 95 | { |
| 96 | return Err(CliError::InvalidArgument { |
| 97 | message: "Nothing to update. Provide at least one of \ |
| 98 | --status, --assignee, --priority, --title, --reason, \ |
| 99 | --informed-by, \ |
| 100 | --body, or --body-stdin." |
| 101 | .to_string(), |
| 102 | }); |
| 103 | } |
| 104 | |
| 105 | let body_updated = content.is_some(); |
| 106 | let info = repo |
| 107 | .vault_intent_update( |
| 108 | &self.id, |
| 109 | IntentUpdateOptions { |
| 110 | status: self.status.clone(), |
| 111 | assignee: self.assignee.clone(), |
| 112 | priority: self.priority.clone(), |
| 113 | title: self.title.clone(), |
| 114 | informed_by: (!self.informed_by.is_empty()).then(|| self.informed_by.clone()), |
| 115 | content, |
| 116 | reason: self.reason.clone(), |
| 117 | force: self.force, |
| 118 | }, |
| 119 | ) |
| 120 | .map_err(CliError::Repository)?; |
| 121 | |
| 122 | println!("Updated intent: {}", info.id); |
| 123 | println!(" status: {}", info.status); |
| 124 | println!(" priority: {}", info.priority); |
| 125 | if let Some(ref assignee) = info.assignee { |
| 126 | println!(" assignee: {}", assignee); |
| 127 | } |
| 128 | if body_updated { |
| 129 | println!(" body: updated"); |
| 130 | } |
| 131 | if !self.informed_by.is_empty() { |
| 132 | println!(" informed by: {} source(s)", self.informed_by.len()); |
| 133 | } |
| 134 | |
| 135 | Ok(()) |
| 136 | } |
| 137 | } |
nothing calls this directly
no test coverage detected