Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs possibly related to command branches #428

Closed
jdvor opened this issue May 22, 2021 · 4 comments · Fixed by #1463
Closed

Bugs possibly related to command branches #428

jdvor opened this issue May 22, 2021 · 4 comments · Fixed by #1463
Assignees
Labels
area-CLI Command-Line Interface bug Something isn't working
Milestone

Comments

@jdvor
Copy link

jdvor commented May 22, 2021

I think I've found at least 2 bugs possibly related to command branches. Here's repo with the example. It's using Spectre.Console 0.39.0.

  • Command options from parent (branch) settings are not taken into account / parsed. In this example PrintBaseSettings.Message. Result is failing ValidateExamles() and when -m MESSAGE is passed as command line argument the value is ignored. Reproduce by uncommenting the line Program.cs:L17
  • Dependency injection through type TypeRegistrar & TypeResolver is called for both command type and their settings, not just command constructor dependencies (IFooService for DecoratedPrintCmd in this example). Maybe this is not a bug, but it is at least unexpected and unusual. Reproduce: comment lines Program.cs:L46-47 and Program.cs:L50-51.
@jdvor jdvor added the bug Something isn't working label May 22, 2021
@willyt150
Copy link

Thank you very much for your example as a workaround for the Dependency Injection trying to use the TypeRegistrar and TypeResolver for the command's settings!

If this is working as intended, could we get the documentation to include the need to add the command setting to the DI provider?

@FrankRay78 FrankRay78 added the area-CLI Command-Line Interface label May 13, 2023
@FrankRay78
Copy link
Contributor

Hello @jdvor, spectre.console just shipped version 0.48 - do you know if the above is still an issue in this version?

@pisethdanh
Copy link

Hello @FrankRay78, CommandArgument seems to work as per this documentation.

However, CommandOption doesn't seem to be parsed correctly. I am seeing the same issue as OP.

@patriksvensson patriksvensson moved this to In Progress 👨‍💻 in Spectre Console Feb 15, 2024
@patriksvensson patriksvensson added this to the 0.49 milestone Feb 15, 2024
@patriksvensson patriksvensson self-assigned this Feb 15, 2024
patriksvensson added a commit to patriksvensson/spectre.console that referenced this issue Feb 15, 2024
patriksvensson added a commit to patriksvensson/spectre.console that referenced this issue Feb 15, 2024
patriksvensson added a commit to patriksvensson/spectre.console that referenced this issue Feb 15, 2024
patriksvensson added a commit that referenced this issue Feb 15, 2024
@github-project-automation github-project-automation bot moved this from In Progress 👨‍💻 to Done 🚀 in Spectre Console Feb 15, 2024
@patriksvensson
Copy link
Contributor

This bug has been fixed and will appear in 0.49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CLI Command-Line Interface bug Something isn't working
Projects
Status: Done 🚀
Development

Successfully merging a pull request may close this issue.

5 participants