File tree Expand file tree Collapse file tree 4 files changed +9
-8
lines changed Expand file tree Collapse file tree 4 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -515,6 +515,8 @@ public static CommandLineBuilder UseVersionOption(
515
515
return true ;
516
516
} ) ;
517
517
518
+ versionOption . DisallowBinding = true ;
519
+
518
520
command . AddOption ( versionOption ) ;
519
521
520
522
builder . AddMiddleware ( async ( context , next ) =>
Original file line number Diff line number Diff line change @@ -12,8 +12,9 @@ public HelpOption() : base(new[]
12
12
"--help" ,
13
13
"-?" ,
14
14
"/?"
15
- } , Resources . Instance . HelpOptionDescription ( ) )
15
+ } , Resources . Instance . HelpOptionDescription ( ) )
16
16
{
17
+ DisallowBinding = true ;
17
18
}
18
19
19
20
internal override Argument Argument
@@ -22,11 +23,6 @@ internal override Argument Argument
22
23
set { }
23
24
}
24
25
25
- protected bool Equals ( HelpOption other )
26
- {
27
- return other != null ;
28
- }
29
-
30
26
public override bool Equals ( object obj )
31
27
{
32
28
return obj is HelpOption ;
Original file line number Diff line number Diff line change @@ -122,6 +122,8 @@ public bool ArgumentIsHidden
122
122
123
123
private IEnumerable < Argument > Arguments => Children . OfType < Argument > ( ) ;
124
124
125
+ internal bool DisallowBinding { get ; set ; }
126
+
125
127
public override string Name
126
128
{
127
129
get => base . Name ;
Original file line number Diff line number Diff line change @@ -37,9 +37,10 @@ internal static bool TryGetValueForOption(
37
37
38
38
for ( var i = 0 ; i < options . Count ; i ++ )
39
39
{
40
- var option = options [ i ] ;
40
+ var option = ( Option ) options [ i ] ;
41
41
42
- if ( valueDescriptor . ValueName . IsMatch ( option ) )
42
+ if ( ! option . DisallowBinding &&
43
+ valueDescriptor . ValueName . IsMatch ( option ) )
43
44
{
44
45
var optionResult = commandResult . FindResultFor ( option ) ;
45
46
You can’t perform that action at this time.
0 commit comments