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

Function walk_to

atomic-cli/src/agent_error.rs:194–206  ·  view source on GitHub ↗

Descend to the node named by a registry key, stopping at the first segment that does not resolve.

(root: &'a clap::Command, key: &str)

Source from the content-addressed store, hash-verified

192/// Descend to the node named by a registry key, stopping at the first segment
193/// that does not resolve.
194fn walk_to<'a>(root: &'a clap::Command, key: &str) -> &'a clap::Command {
195 let mut node = root;
196 if key.is_empty() {
197 return node;
198 }
199 for part in key.split(' ') {
200 match node.find_subcommand(part) {
201 Some(child) => node = child,
202 None => break,
203 }
204 }
205 node
206}
207
208fn ctx_str(err: &clap::Error, kind: ContextKind) -> Option<String> {
209 match err.get(kind) {

Callers 3

option_spellingsFunction · 0.85
short_cluster_valueFunction · 0.85
renderFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected