Descend to the node named by a registry key, stopping at the first segment that does not resolve.
(root: &'a clap::Command, key: &str)
| 192 | /// Descend to the node named by a registry key, stopping at the first segment |
| 193 | /// that does not resolve. |
| 194 | fn 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 | |
| 208 | fn ctx_str(err: &clap::Error, kind: ContextKind) -> Option<String> { |
| 209 | match err.get(kind) { |
no test coverage detected