dotnet / dotnet/command-line-api
Completions can be called from Help and it's hard to make the distinction
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
Currently if I don't want to show completions in the help text, I have to ressort to this method to detect if that was the help that called my completions (and that only works because I use subcommands):
```C#
private static bool IsHelpCall(CompletionContext context)
{
return context.ParseResult.CommandResult?.Command is RootCommand;
}
```
I'd like to have an API for this, maybe adding an enum "InvocationContext(Suggest|ShowHelp)" to the CompletionContext?
It's not crucial to the issue but here are a few reasons I want to show different results:
- completions can be slow to return
- there can be a lot of results, especially if WordToComplete is empty
- I just don't want to show them in the help text
Contributor guide
Assessment
This issue has not been assessed yet.