natemcmaster/CommandLineUtils

Option attribute doesn't support property overrides

d1820 opened this issue · 3 comments

d1820 commented

Describe the bug
If a property is marked as virtual and in a base class with the options attribute applied. When an override of that property is the implemented the option attribute complains for duplicate names.

To Reproduce

Base class

[Option(CommandOptionType.SingleValue, LongName = "folder", ShortName = "f", Description = "The folder to execute actions in. This could be where to read from or where to output to")]
        public virtual string WorkingFolder { get; set; }

Override Class

[Option(CommandOptionType.SingleValue, LongName = "folder", ShortName = "f", Description = "Override Description")]
        public override string WorkingFolder { get; set; }

Expected behavior
The option attribute of the override should be applied.

Error

Ambiguous option name. Both CLI.CliBase.WorkingFolder and CLI.Infra.PullCmd.WorkingFolder produce a CommandOption with the name 'f'.

Seems like the override option should win. This fix is probably a matter of improving the reflection to recognize overrides. Marking as help-wanted as I would accept a pull request to fix this behavior.

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.