diff --git a/src/builder/value_parser.rs b/src/builder/value_parser.rs index 94293a6e..fc2c1754 100644 --- a/src/builder/value_parser.rs +++ b/src/builder/value_parser.rs @@ -342,10 +342,19 @@ impl TypedValueParser for PathBufValueParser { fn parse( &self, - _cmd: &crate::Command, - _arg: Option<&crate::Arg>, + cmd: &crate::Command, + arg: Option<&crate::Arg>, value: std::ffi::OsString, ) -> Result { + if value.is_empty() { + return Err(crate::Error::empty_value( + cmd, + &[], + arg.map(ToString::to_string) + .unwrap_or_else(|| "...".to_owned()), + crate::output::Usage::new(cmd).create_usage_with_title(&[]), + )); + } Ok(Self::Value::from(value)) } }