JasperFx/oakton

Wrong help generated for dictionaries

rioka opened this issue · 0 comments

rioka commented

Generated help for dictionaries is wrong, as it includes 4 dashes (----) instead of 2

public class RunInput {

  [Description("The connection string", Name = "connection-string")]
  public string ConnectionString { get; set; }

  [Description("Check scripts to be applied, but do not run them")]
  [FlagAlias("dry-run")]
  public bool DryRunFlag { get; set; }

  [Description("An optional list of variables to be used in scripts")]
  public Dictionary<string, string> VarFlag { get; set; } = new Dictionary<string, string>();
}
run - Create or update a database
└── Create or update a database
    └── dotnet run -- run <connectionstring>
        ├── [-d, --dry-run]
        └── [----var:<prop> <value>]

I guess this happens as a result of

private static readonly string LONG_FLAG_PREFIX = "--";

return new FlagAliases
{
ShortForm = (SHORT_FLAG_PREFIX + oneLetterName),
LongForm = LONG_FLAG_PREFIX + name.ToLower(),
LongFormOnly = longFormOnly
};

var flagAliases = InputParser.ToFlagAliases(Member);
_prefix = flagAliases.LongForm + ":";

and finally

return $"[--{_prefix}<prop> <value>]";