pub fn encode_cmd(cmd: &str) -> StringExpand description
Percent-encode a command string for safe inclusion in a URL path.
Only unreserved characters (alphanumeric, -, _, ., ~) are kept as-is.
Everything else is encoded as %XX using uppercase hex. This prevents
URL injection via crafted command strings containing &, %, ?, #, etc.