Skip to content

Commit

Permalink
Fix/hidden cli option not detected (#7697)
Browse files Browse the repository at this point in the history
  • Loading branch information
asdacap authored Nov 1, 2024
1 parent 26a2e89 commit d2f4b15
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Nethermind/Nethermind.Runner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,27 @@ void AddConfigurationOptions(CliCommand command)

ConfigCategoryAttribute? typeLevel = configType.GetCustomAttribute<ConfigCategoryAttribute>();

if (typeLevel is not null && (typeLevel.DisabledForCli || typeLevel.HiddenFromDocs))
if (typeLevel is not null && typeLevel.DisabledForCli)
continue;

bool categoryHidden = typeLevel?.HiddenFromDocs == true;

foreach (PropertyInfo propertyInfo in
configType.GetProperties(BindingFlags.Public | BindingFlags.Instance).OrderBy(p => p.Name))
{
ConfigItemAttribute? configItemAttribute = propertyInfo.GetCustomAttribute<ConfigItemAttribute>();

if (configItemAttribute?.DisabledForCli == false || configItemAttribute?.HiddenFromDocs == false)
if (configItemAttribute?.DisabledForCli != true)
{
bool hidden = categoryHidden || configItemAttribute?.HiddenFromDocs == true;

command.Add(new CliOption<string>(
$"--{ConfigExtensions.GetCategoryName(configType)}.{propertyInfo.Name}",
$"--{ConfigExtensions.GetCategoryName(configType)}-{propertyInfo.Name}".ToLowerInvariant())
{
Description = configItemAttribute?.Description,
HelpName = "value"
HelpName = "value",
Hidden = hidden
});
}

Expand Down

0 comments on commit d2f4b15

Please sign in to comment.