@@ -10,23 +10,25 @@ namespace System.CommandLine
1010 /// <summary>
1111 /// A symbol defining a named parameter and a value for that parameter.
1212 /// </summary>
13- public abstract class CliOption : CliSymbol
13+ public abstract class CliOption : CliDataSymbol
1414 {
15- // TODO: don't expose field
1615 internal AliasSet ? _aliases ;
17- /*
16+ /*
1817 private List<Action<OptionResult>>? _validators;
1918
2019 */
2120
22- private protected CliOption ( string name , string [ ] aliases ) : base ( name )
21+ private protected CliOption ( string name , string [ ] aliases )
22+ : base ( name )
2323 {
24- if ( aliases is { Length : > 0 } )
24+ if ( aliases is { Length : > 0 } )
2525 {
2626 _aliases = new ( aliases ) ;
2727 }
2828 }
2929
30+ public override Type ValueType => Argument . ValueType ;
31+
3032 /// <summary>
3133 /// Gets the <see cref="Argument">argument</see> for the option.
3234 /// </summary>
@@ -37,8 +39,8 @@ private protected CliOption(string name, string[] aliases) : base(name)
3739 /// </summary>
3840 public bool HasDefaultValue => Argument . HasDefaultValue ;
3941
40- // TODO: help
41- /*
42+ // TODO: help
43+ /*
4244 /// <summary>
4345 /// Gets or sets the name of the Option when displayed in help.
4446 /// </summary>
@@ -51,7 +53,7 @@ public string? HelpName
5153 get => Argument.HelpName;
5254 set => Argument.HelpName = value;
5355 }
54- */
56+ */
5557
5658 /// <summary>
5759 /// Gets or sets the arity of the option.
@@ -62,8 +64,8 @@ public ArgumentArity Arity
6264 set => Argument . Arity = value ;
6365 }
6466
65- // TODO: recursive options, validators, completion
66- /*
67+ // TODO: recursive options, validators, completion
68+ /*
6769 /// <summary>
6870 /// When set to true, this option will be applied to its immediate parent command or commands and recursively to their subcommands.
6971 /// </summary>
@@ -80,9 +82,9 @@ public ArgumentArity Arity
8082 /// Gets the list of completion sources for the option.
8183 /// </summary>
8284 public List<Func<CompletionContext, IEnumerable<CompletionItem>>> CompletionSources => Argument.CompletionSources;
83- */
85+ */
8486
85- // TODO: what does this even mean?
87+ // TODO: what does this even mean?
8688 /// <summary>
8789 /// Gets a value that indicates whether multiple argument tokens are allowed for each option identifier token.
8890 /// </summary>
@@ -98,10 +100,10 @@ public ArgumentArity Arity
98100 /// </example>
99101 public bool AllowMultipleArgumentsPerToken { get ; set ; }
100102
101- // TODO: rename to IsGreedy
103+ // TODO: rename to IsGreedy
102104 internal virtual bool Greedy => Argument . Arity . MinimumNumberOfValues > 0 && Argument . ValueType != typeof ( bool ) ;
103-
104- // TODO: rename to IsRequired
105+
106+ // TODO: rename to IsRequired and move to Validation
105107 /// <summary>
106108 /// Indicates whether the option is required when its parent command is invoked.
107109 /// </summary>
@@ -114,8 +116,8 @@ public ArgumentArity Arity
114116 /// <remarks>The collection does not contain the <see cref="CliSymbol.Name"/> of the Option.</remarks>
115117 public ICollection < string > Aliases => _aliases ??= new ( ) ;
116118
117- // TODO: invocation, completion
118- /*
119+ // TODO: invocation, completion
120+ /*
119121 /// <summary>
120122 /// Gets or sets the <see cref="CliAction"/> for the Option. The handler represents the action
121123 /// that will be performed when the Option is invoked.
0 commit comments