pub fn label(command: &str) -> StringExpand description
Derive a short label from a command string.
Extracts the binary name, skipping any leading sudo/env prefix and
stripping any path prefix. For example:
- “cargo test” → “cargo”
- “/usr/bin/python script.py” → “python”
- “gh issue list” → “gh”
- “sudo cargo test” → “cargo”
- “env FOO=bar cargo test” → “cargo”
If stripping the prefix leaves no token, the original first token is returned (e.g., “sudo” → “sudo”, “env” → “env”).
§Arguments
command- The command string
§Returns
A short label derived from the command.