JasperFx / oakton

Parsing and Utilities for Command Line Tools in .Net
http://jasperfx.github.io/oakton
Apache License 2.0
308 stars 41 forks source link

Wrong help generated for dictionaries #67

Closed rioka closed 2 years ago

rioka commented 2 years ago

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

https://github.com/JasperFx/oakton/blob/cf9e006686a69cf9e77785deefb5a2a21d5b911a/src/Oakton/Parsing/InputParser.cs#L14

https://github.com/JasperFx/oakton/blob/cf9e006686a69cf9e77785deefb5a2a21d5b911a/src/Oakton/Parsing/InputParser.cs#L111-L116

https://github.com/JasperFx/oakton/blob/cf9e006686a69cf9e77785deefb5a2a21d5b911a/src/Oakton/Parsing/DictionaryFlag.cs#L20-L22

and finally

https://github.com/JasperFx/oakton/blob/cf9e006686a69cf9e77785deefb5a2a21d5b911a/src/Oakton/Parsing/DictionaryFlag.cs#L61