pub fn format_command(command: &str, args: &[&str]) -> StringExpand description
Formats a control protocol command with arguments.
Creates a properly formatted command string ready to send to the
control socket. The command is terminated with \r\n as required
by the protocol.
§Arguments
command- The command name (e.g., “GETINFO”, “SETCONF”)args- Slice of argument strings to append to the command
§Returns
A formatted command string ending with \r\n.
§Example
use stem_rs::protocol::format_command;
// Command without arguments
let cmd = format_command("AUTHENTICATE", &[]);
assert_eq!(cmd, "AUTHENTICATE\r\n");
// Command with single argument
let cmd = format_command("GETINFO", &["version"]);
assert_eq!(cmd, "GETINFO version\r\n");
// Command with multiple arguments
let cmd = format_command("SETCONF", &["key1=value1", "key2=value2"]);
assert_eq!(cmd, "SETCONF key1=value1 key2=value2\r\n");