Fix usage of --input=null

This commit is contained in:
David Peter 2023-03-21 20:55:03 +01:00 committed by David Peter
parent fbe9ca6669
commit 80ec1c5ddf
2 changed files with 17 additions and 6 deletions

View File

@ -15,6 +15,13 @@
## Other
# v1.16.1
## Bugfixes
- Fix line-wrapping of `--help` text (@sharkdp)
- Fix `--input=null` (@sharkdp)
# v1.16.0

View File

@ -379,13 +379,17 @@ impl Options {
}
options.command_input_policy = if let Some(path_str) = matches.get_one::<String>("input") {
let path = PathBuf::from(path_str);
if !path.exists() {
return Err(OptionsError::StdinDataFileDoesNotExist(
path_str.to_string(),
));
if path_str == "null" {
CommandInputPolicy::Null
} else {
let path = PathBuf::from(path_str);
if !path.exists() {
return Err(OptionsError::StdinDataFileDoesNotExist(
path_str.to_string(),
));
}
CommandInputPolicy::File(path)
}
CommandInputPolicy::File(path)
} else {
CommandInputPolicy::Null
};