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

--version not showing version when default command set #1216

Open
yufeih opened this issue Apr 14, 2023 · 6 comments · Fixed by #1259 · May be fixed by #1663
Open

--version not showing version when default command set #1216

yufeih opened this issue Apr 14, 2023 · 6 comments · Fixed by #1259 · May be fixed by #1663
Assignees
Labels
area-CLI Command-Line Interface bug Something isn't working ⭐ top bug Top bug.
Milestone

Comments

@yufeih
Copy link

yufeih commented Apr 14, 2023

Information

  • OS: [all]
  • Version: [0.46.0]

To Reproduce

  • Set default command using SetDefaultCommand
  • Run mycmd --version
  • Version not shown

Expected behavior
Shows version instead of executing default command

Additional context

Seemingly caused by this check

@yufeih yufeih added bug Something isn't working needs triage labels Apr 14, 2023
@github-project-automation github-project-automation bot moved this to Todo 🕑 in Spectre Console Apr 14, 2023
@FrankRay78 FrankRay78 added the area-CLI Command-Line Interface label May 13, 2023
@FrankRay78 FrankRay78 self-assigned this Jul 3, 2023
@FrankRay78
Copy link
Contributor

FYI. I've nearly fixed this and will submit a PR soon (likely in the coming weeks).

@FrankRay78 FrankRay78 linked a pull request Jul 5, 2023 that will close this issue
@FrankRay78 FrankRay78 linked a pull request Sep 2, 2023 that will close this issue
@github-project-automation github-project-automation bot moved this from Todo 🕑 to Done 🚀 in Spectre Console Sep 8, 2023
@my522cn
Copy link

my522cn commented Jul 12, 2024

I don‘t think this bug has fixed.
When I using SetDefaultCommand, -v is still not work.
spectre.console version: 0.49.1

@FrankRay78 FrankRay78 reopened this Aug 1, 2024
@github-project-automation github-project-automation bot moved this from Done 🚀 to In Progress 👨‍💻 in Spectre Console Aug 1, 2024
@FrankRay78
Copy link
Contributor

I'll take a look @my522cn, please be on hand if I need help reproducing it.

@FrankRay78
Copy link
Contributor

FrankRay78 commented Aug 3, 2024

Unfortunately it's still broken in 0.49.1 @my522cn

Here is my command and application:

using Spectre.Console;
using Spectre.Console.Cli;


public class EmptyCommand : Command<EmptyCommandSettings>
{
    public override int Execute(CommandContext context, EmptyCommandSettings settings)
    {
        AnsiConsole.MarkupLine("Hello world");
        return 0;
    }
}


public static class Program
{
    public static int Main(string[] args)
    {
        var app = new CommandApp();

        app.SetDefaultCommand<EmptyCommand>();
        app.Configure(config =>
        {
            config.SetApplicationVersion("1.0");
        });

        return app.Run(args);
    }
}

The default command is executed, not the version shown:

image

Expected behavior
Shows version instead of executing default command

@FrankRay78 FrankRay78 moved this from In Progress 👨‍💻 to Todo 🕑 in Spectre Console Aug 3, 2024
@FrankRay78 FrankRay78 added bug Something isn't working and removed bug Something isn't working needs triage labels Aug 3, 2024
@FrankRay78 FrankRay78 added this to the 1.0 milestone Aug 12, 2024
@FrankRay78 FrankRay78 linked a pull request Aug 13, 2024 that will close this issue
@my522cn
Copy link

my522cn commented Nov 28, 2024

I don‘t think this bug has fixed. When I using SetDefaultCommand, -v is still not work. spectre.console version: 0.49.1

0.49.0
Still not work

@FrankRay78
Copy link
Contributor

I don‘t think this bug has fixed. When I using SetDefaultCommand, -v is still not work. spectre.console version: 0.49.1

0.49.0 Still not work

It's not fixed, however once the PR above (#1663) is merged, it will be!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment