natemcmaster/CommandLineUtils

Inheritance and Options are broken

peter-shinydocs opened this issue · 3 comments

Describe the bug

  • Somewhere between 2.4.4 and 2.5.0 something changed that breaks inheritance with the options.
  • Getting

System.InvalidOperationException : Ambiguous option name. Both Shinydocs.CognitiveToolkit.Tests.UI.CommandLine.Commands.BaseCommand.Test and Shinydocs.CognitiveToolkit.Tests.UI.CommandLine.Commands.DerivedCommand.Test produce a CommandOption with the name 't'.

  • Suspected change .. #288

To Reproduce
Steps to reproduce the behavior:

  1. Set up Classes
public abstract class BaseCommand
{
	
[Option(Description = "Example (Required)")]
	[Required]
	
public string? Test { get; set; }
}



[Command(Name = "CognitiveToolkit Test")]

public class DerivedCommand : BaseCommand
{
	
[Option(Description = "I actually want this description  (Required)")]
	[Required]
	
public new string? Test { get; set; }
}
  1. Run cli.Conventions.UseDefaultConventions();

Expected behavior
I get the description of the derived class (like it was in 2.4.4

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

I'm not sure if there is a way at runtime to handle this, but if you can figure it out, feel free to propose a pull-request to fix.

Marking this as help-wanted.

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please comment if you believe this should remain open, otherwise it will be closed in 14 days. Thank you for your contributions to this project.

Closing due to inactivity.
If you are looking at this issue in the future and think it should be reopened, please make a commented here and mention natemcmaster so he sees the notification.