You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When displaying default values do not display [] when value is null #2582
I have some default values that can be sourced from environment variables if they're present.
For example,
varpasswordOption=newOption<string?>("--password"."-p","/p"){Description="The password to use.",DefaultValueFactory= defaultValue =>{if(string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("_Password"))){returnnull;}returnEnvironment.GetEnvironmentVariable("_Password");}};
Currently the help text would display
-p, --password The password to use. []
It would, to my mind, be cleaner if, when the DefaultValueFactory returns null that nothing is displayed as the default, because in this case there is no default.
changed the title [-]When displaying default values do not disable when value is null[/-][+]When displaying default values do not display [] when value is null[/+]on Jun 21, 2025
Activity
[-]When displaying default values do not disable when value is null[/-][+]When displaying default values do not display [] when value is null[/+]barrygiles commentedon Jun 23, 2025
+1 for this
It also affects required options, in that the system thinks the option has been set (with null), whereas practically speaking it hasn't.
fix dotnet#2592, dotnet#2582, dotnet#2573
fix dotnet#2592, dotnet#2582, dotnet#2573
Fix some help and `GetRequiredValue` issues (#2601)