Replies: 2 comments 8 replies
-
Yes, simple conversions for In the mean time, you should be able to do #[clap(value_parser = clap::builder::OsStringValueParser::new().map(|s| ...))] |
Beta Was this translation helpful? Give feedback.
-
When I tried substituting PathBufValueParser for PathBuf, I get an error:
When I followed the suggestion, I got a different error:
Do you have any other thoughts or suggestions? |
Beta Was this translation helpful? Give feedback.
-
Previously it was quite simple - I could use
#[clap(parse(from_os_str))]
, but now it doesn't work.It also doesn't work automatically - I'm getting:
on my custom type. So it looks like I need to create my own
ValueParserFactory
, but apparently I haven't found any docs explaining how to do it.But my type already supports
From<&OsStr>
through this blanket impl:Why clap couldn't just use existing standard conversions like
TryFrom<&OsStr>
orFrom<&OsStr>
if they are defined?Is there any way to tell it to use my
From
conversion?Beta Was this translation helpful? Give feedback.
All reactions