Dynamic Default Values
In most cases, it is enough to define static default values, which are known during compile-time.
However, there are use-cases when you would consider dynamic default values or when a default value depends on another option value.
Imagine your application takes two arguments:
StartDate
[mandatory] and EndDate
[optional]
If EndDate
is not provided in the command-line, it should be Startdate + 7 days
. In that case, you cannot define a static default value for Enddate
because it depends on another value.
To accomplish this, override the BeforeExecute()
method in your Command.
Last updated