envy icon indicating copy to clipboard operation
envy copied to clipboard

variable as Vec<PathBuf> where paths could contain commas?

Open Boscop opened this issue 5 years ago • 2 comments

The readme says that it supports parsing into Vec by separating the values by commas. If I want to parse a variable as Vec<PathBuf> where each path could contain commas, would it work by putting that path in single quotes? E.g.

FOLDERS='C:\Foo,Bar',D:\Baz

resulting in vec![r"C:\Foo,Bar", r"D:\Baz"]?

And if there is a space after the separating comma, it won't work, right?

Boscop avatar Jul 07 '18 16:07 Boscop

Hi @Boscop thanks for reaching out. Very interesting usecase.

Envy leverages a type called IntoDersializer to deserialize spefic types. Without looking closely I would have believe types that derive deserialize may get this for free. I see an impl of derialize for pathbuf here

I don't have tests for values containing commas for types derserializing into vecs so this may be a blindspot in the crate.

I think it's a solvable problem though. I'll take a look. Let me know if you have ideas.

softprops avatar Jul 07 '18 18:07 softprops

I've used PathBuf with envy before, but the question is mainly about how to separate them with commas when some values can contain commas. It would also apply to Vec<String> etc.

Boscop avatar Jul 09 '18 14:07 Boscop