adrianaisemberg/CLAP

Allow [DirectoryExists], [FileExists], [PathExists] to be applied to global parameters

rossipedia opened this issue · 3 comments

I'd like to expose a global parameter that is essentially a data directory.

I'm trying to do something like:

[Global("d")]
[DirectoryExists]
public void DataDir(string dir)
{
    this.dataDir = dir;
}

But, of course I can't because the DirectoryExistsAttribute is marked with [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]

It would be very helpful to allow these validation attributes on global parameters

I agree. Please send me a pull request with the changes and please make
sure there are unit tests that cover this new feature.

Thanks,
Adrian

On Fri, Mar 27, 2015, 10:49 AM Bryan J. Ross notifications@github.com
wrote:

I'd like to expose a global parameter that is essentially a data directory.

I'm trying to do something like:

[Global("d")]
[DirectoryExists]public void DataDir(string dir)
{
this.dataDir = dir;
}

But, of course I can't because the DirectoryExistsAttribute is marked
with [AttributeUsage(AttributeTargets.Property |
AttributeTargets.Parameter)]

It would be very helpful to allow these validation attributes on global
parameters


Reply to this email directly or view it on GitHub
#32.

For sure. I've forked the repo and set up a branch, I'll try to dig in sometime over the next couple of days.

Cheers!

On Fri, Mar 27, 2015, 12:43 PM Bryan J. Ross notifications@github.com
wrote:

For sure. I've forked the repo and set up a branch, I'll try to dig in
sometime over the next couple of days.


Reply to this email directly or view it on GitHub
#32 (comment).