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

[Question] Handling global options in CLI apps with v5 framework #140

Open
rozumak opened this issue Sep 2, 2024 · 3 comments
Open

[Question] Handling global options in CLI apps with v5 framework #140

rozumak opened this issue Sep 2, 2024 · 3 comments

Comments

@rozumak
Copy link

rozumak commented Sep 2, 2024

It's common for CLI apps to have global/common options that apply to most commands. These options are usually placed before the command text.

For example, in Entity Framework:

dotnet ef [options] [command]

Global options:
  --no-color       Don't colorize output.
  --prefix-output  Prefix output with level.

What is your recommendation for handling these cases using your v5 framework? Is there any support or plans to support this?

Thanks for the great framework!

@neuecc
Copy link
Member

neuecc commented Sep 9, 2024

That's a good suggestion, I'd like to consider adding it.

Copy link

github-actions bot commented Mar 9, 2025

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Mar 9, 2025
@jamesfoster
Copy link

@neuecc Looks like this issue has been raised several times but auto-closed due to inactivity. Any chance you could look at porting @riddlemd 's PR to the latest version? #100

I realise that implementation may not be sufficient or applicable in the latest version. I would ask, if there's a global parameter --quite , for example, do I access that through a property base.Quite, or do I need a bool quiet parameter on all my commands? Thinking about something like --nologo it would be cool to have something that runs before all commands.

public abstract class BaseCommand
{
    /// <param name="nologo">Hide the logo</param>
    public void Before(bool nologo) // somehow register this to run before ALL commands
    {
        if (!nologo) PrintLogo();
    }
}

Thanks.

@github-actions github-actions bot removed the stale label Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants