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

Method run

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

Source from the content-addressed store, hash-verified

72
73impl 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}

Callers

nothing calls this directly

Calls 5

find_repository_rootFunction · 0.85
is_noneMethod · 0.80
vault_intent_updateMethod · 0.80
resolve_bodyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected