@@ -50,19 +50,22 @@ public static string GetArgumentUsageLabel(Symbol parameter)
50
50
// By default Option.Name == Argument.Name, don't repeat it
51
51
return parameter switch
52
52
{
53
- Argument argument => GetUsageLabel ( argument . HelpName , argument . ValueType , argument . CompletionSources , argument ) ?? $ "<{ argument . Name } >",
54
- Option option => GetUsageLabel ( option . HelpName , option . ValueType , option . CompletionSources , option ) ?? "" ,
53
+ Argument argument => GetUsageLabel ( argument . HelpName , argument . ValueType , argument . CompletionSources , argument , argument . Arity ) ?? $ "<{ argument . Name } >",
54
+ Option option => GetUsageLabel ( option . HelpName , option . ValueType , option . CompletionSources , option , option . Arity ) ?? "" ,
55
55
_ => throw new InvalidOperationException ( )
56
56
} ;
57
57
58
- static string ? GetUsageLabel ( string ? helpName , Type valueType , List < Func < CompletionContext , IEnumerable < CompletionItem > > > completionSources , Symbol symbol )
58
+ static string ? GetUsageLabel ( string ? helpName , Type valueType , List < Func < CompletionContext , IEnumerable < CompletionItem > > > completionSources , Symbol symbol , ArgumentArity arity )
59
59
{
60
60
// Argument.HelpName is always first choice
61
61
if ( ! string . IsNullOrWhiteSpace ( helpName ) )
62
62
{
63
63
return $ "<{ helpName } >";
64
64
}
65
- else if ( ! ( valueType == typeof ( bool ) || valueType == typeof ( bool ? ) ) && completionSources . Count > 0 )
65
+ else if (
66
+ ! ( valueType == typeof ( bool ) || valueType == typeof ( bool ? ) )
67
+ && arity . MaximumNumberOfValues > 0 // allowing zero arguments means we don't need to show usage
68
+ && completionSources . Count > 0 )
66
69
{
67
70
IEnumerable < string > completions = symbol
68
71
. GetCompletions ( CompletionContext . Empty )
0 commit comments