Skip to main content

needs_quoting

Function needs_quoting 

Source
pub fn needs_quoting(value: &str) -> bool
Expand description

Check if a string needs quoting for shell usage

Returns true if the string contains characters that would be interpreted specially by the shell.

ยงExamples

use command_stream::quote::needs_quoting;

assert!(!needs_quoting("hello"));
assert!(needs_quoting("hello world"));
assert!(needs_quoting("$PATH"));