opt.isDirectory: Error: template commandr.validators.validateEachWith cannot deduce function from argument types !()(Option, void), candidates are:
mw66 opened this issue · comments
mw66 commented
I tried the example code:
.validateEachWith(opt => opt.isDirectory), "must be a valid directory");
but it errors out:
Error: template commandr.validators.validateEachWith cannot deduce function from argument types !()(Option, void), candidates are:
.dub/packages/commandr-0.1.1/commandr/source/commandr/validators.d(458,10): validateEachWith(T : IEntry)(T entry, void delegate(IEntry, string) validator)
.dub/packages/commandr-0.1.1/commandr/source/commandr/validators.d(488,10): validateEachWith(T : IEntry)(T entry, bool delegate(string) validator, string errorMessage)
I changed to isDir
or isFile
:
https://dlang.org/library/std/file/is_dir.html
https://dlang.org/library/std/file/is_file.html
still doesn't work. Should the function
be added in addition to delegate
?
And can you add an example.d?
mw66 commented
Actually, this is because in the doc, the bracket is in the wrong place:
.validateEachWith(opt => opt.isDirectory), "must be a valid directory")
should be ==>
.validateEachWith(opt => opt.isDir, "must be a valid directory"))