Skip to main content

render_ambiguity

Function render_ambiguity 

Source
pub fn render_ambiguity(input: &str, candidates: &[String]) -> String
Expand description

Render a human-readable disambiguation message.

Used when a command token matches more than one candidate as a prefix. The message lists all candidate canonical names so the user or agent can choose the intended command.

§Arguments

  • input — The ambiguous token as typed by the user.
  • candidates — Canonical names of all matching commands.

§Examples

let msg = render_ambiguity("l", &["list".to_string(), "log".to_string()]);
assert!(msg.contains("Ambiguous command"));
assert!(msg.contains("list"));
assert!(msg.contains("log"));