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

Don't show command examples at root #189

Closed
patriksvensson opened this issue Aug 23, 2020 · 3 comments · Fixed by #1259
Closed

Don't show command examples at root #189

patriksvensson opened this issue Aug 23, 2020 · 3 comments · Fixed by #1259
Assignees
Labels
area-CLI Command-Line Interface bug Something isn't working

Comments

@patriksvensson
Copy link
Contributor

Only examples specified on the root should show at the root. If examples are specified for commands it should not show up at the root since this is a bit confusing.

@patriksvensson patriksvensson transferred this issue from spectresystems/spectre.cli Dec 30, 2020
@patriksvensson patriksvensson added cli bug Something isn't working labels Dec 30, 2020
@libe
Copy link

libe commented Jun 18, 2022

Hi, this is really an issue where you have complex sub commands and you need to show a list of examples per sub command. Hope this gets scheduled for fix in the next release, btw fantastic library! 👏

@patriksvensson
Copy link
Contributor Author

@libe Thank you! I'm currently on vacation until August and haven't really planned on working a lot on Spectre.Console during this time, but if you feel that this is important, a PR is always appreciated! 😊

@FrankRay78 FrankRay78 self-assigned this Jan 2, 2023
@FrankRay78 FrankRay78 added the area-CLI Command-Line Interface label May 13, 2023
@FrankRay78 FrankRay78 linked a pull request Jul 5, 2023 that will close this issue
@FrankRay78
Copy link
Contributor

Hi @patriksvensson, I have marked this issue as being fully address by PR #1252, not because it removes the default behaviour of displaying examples from direct children when the root contains none. Rather because you can now turn this behaviour off, if desired, by configurator.Settings.MaximumIndirectExamples = 0; Alternatively, this is also now possible:

            fixture.Configure(configurator =>
            {
                configurator.SetApplicationName("myapp");

                // Show the first 8 examples defined on the direct children
                configurator.Settings.MaximumIndirectExamples = 8;

                configurator.AddCommand<DogCommand>("dog")
                    .WithExample("dog", "--name", "Rufus", "--age", "12", "--good-boy")
                    .WithExample("dog", "--name", "Luna")
                    .WithExample("dog", "--name", "Charlie")
                    .WithExample("dog", "--name", "Bella")
                    .WithExample("dog", "--name", "Daisy")
                    .WithExample("dog", "--name", "Milo");

                configurator.AddCommand<HorseCommand>("horse")
                    .WithExample("horse", "--name", "Brutus")
                    .WithExample("horse", "--name", "Sugar", "--IsAlive", "false")
                    .WithExample("horse", "--name", "Cash")
                    .WithExample("horse", "--name", "Dakota")
                    .WithExample("horse", "--name", "Cisco")
                    .WithExample("horse", "--name", "Spirit");
            });

At one point in the PR, I had removed the code to display examples from children entirely, but felt it was heavyhanded and may have removed what could be quite a useful default behaviour. For example, the issue #1180 (which is quite a bit newer than this one) makes no mention of the need to remove the default behaviour.

Anyhow, that's a more in-depth explanation of why the PR has been implemented as it has been.

@FrankRay78 FrankRay78 linked a pull request Sep 2, 2023 that will close this issue
@github-project-automation github-project-automation bot moved this to Done 🚀 in Spectre Console Sep 8, 2023
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 🚀
3 participants