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

Function complete_change_hashes

atomic-cli/src/commands/complete.rs:91–106  ·  view source on GitHub ↗

Dynamic completer for change-hash arguments, annotating each hash with its commit message as the completion description.

(current: &OsStr)

Source from the content-addressed store, hash-verified

89/// Dynamic completer for change-hash arguments, annotating each hash with its
90/// commit message as the completion description.
91pub(crate) fn complete_change_hashes(current: &OsStr) -> Vec<CompletionCandidate> {
92 let prefix = current.to_string_lossy();
93 let Ok(repo) = require_repository(None) else {
94 return Vec::new();
95 };
96 change_hash_candidates(&repo, &prefix)
97 .into_iter()
98 .map(|(hash, msg)| {
99 let cand = CompletionCandidate::new(hash);
100 match msg {
101 Some(m) => cand.help(Some(m.into())),
102 None => cand,
103 }
104 })
105 .collect()
106}
107
108#[cfg(test)]
109mod tests {

Callers

nothing calls this directly

Calls 3

require_repositoryFunction · 0.85
change_hash_candidatesFunction · 0.85
into_iterMethod · 0.45

Tested by

no test coverage detected