Closed Fed03 closed 8 months ago
@Fed03 Sorry, but I am unable to reproduce that.
The code I used was:
using Spectre.Console;
using Spectre.Console.Cli;
var app = new CommandApp();
app.Configure(c =>
{
c.AddCommand<SendNormalizedRecordToLime>("send");
c.AddCommand<NormalizeLimeCsvCommand>("normalize");
});
return app.Run(args);
internal abstract class BaseCommand : Command
{
public override int Execute(CommandContext context)
{
AnsiConsole.MarkupLine($"Hello from [green]{GetType().Name}[/].");
return 0;
}
}
internal sealed class SendNormalizedRecordToLime : BaseCommand
{
}
internal sealed class NormalizeLimeCsvCommand : BaseCommand
{
}
Which produced the expected result of:
➜ dotnet run
USAGE:
test.dll [OPTIONS] <COMMAND>
OPTIONS:
-h, --help Prints help information
-v, --version Prints version information
COMMANDS:
send
normalize
However, I don't have access to a mac using iTerm2.
Could you try again in another terminal? (Am I correct in assuming your Rider Terminal is also setup to utilize iTerm2?)
@nils-a sorry for the late answer. I tried exactly with your code and experienced the same problem. I tried also with the built-in terminal and with hyper.is, trying also with different shells (sh, bash) other than the default zsh.
I want to highlight that if I add a simple description to at least one command, like this
c.AddCommand<SendNormalizedRecordToLime>("send").WithDescription("dd");
c.AddCommand<NormalizeLimeCsvCommand>("normalize");
we obtain the expected result
➜ dotnet run
USAGE:
Spectre.Test.dll [OPTIONS] <COMMAND>
OPTIONS:
-h, --help Prints help information
-v, --version Prints version information
COMMANDS:
send dd
normalize
let me know if I can help you
Closing this issue, feel free to reopen @Fed03 if it's still an issue and you can make available a complete project / Gist that reproduces it for you.
Information
Describe the bug When calling the the CommandApp via CLI without a default Command, the commands section of the displayed help message does not list anything.
To Reproduce Just configure a CommandApp without a default command and with a bunch of standard commands, i.e.
Then, simply execute
dotnet run
.Expected behavior I expect to see listed the following in the commands section:
Screenshots