@@ -25,22 +25,22 @@ type ActionContext =
25
25
CancellationToken = System.Threading.CancellationToken.None
26
26
}
27
27
28
- type HandlerInputSource =
28
+ type ActionInputSource =
29
29
| ParsedOption of Option
30
30
| ParsedArgument of Argument
31
31
| Context
32
32
33
- type HandlerInput ( source : HandlerInputSource ) =
33
+ type ActionInput ( source : ActionInputSource ) =
34
34
member this.Source = source
35
35
36
- type HandlerInput < 'T >( inputType : HandlerInputSource ) =
37
- inherit HandlerInput ( inputType)
36
+ type ActionInput < 'T >( inputType : ActionInputSource ) =
37
+ inherit ActionInput ( inputType)
38
38
39
39
/// Converts a System.CommandLine.Option<'T> for usage with the CommandBuilder.
40
- static member OfOption < 'T >( o : Option < 'T >) = o :> Option |> ParsedOption |> HandlerInput < 'T>
40
+ static member OfOption < 'T >( o : Option < 'T >) = o :> Option |> ParsedOption |> ActionInput < 'T>
41
41
42
42
/// Converts a System.CommandLine.Argument<'T> for usage with the CommandBuilder.
43
- static member OfArgument < 'T >( a : Argument < 'T >) = a :> Argument |> ParsedArgument |> HandlerInput < 'T>
43
+ static member OfArgument < 'T >( a : Argument < 'T >) = a :> Argument |> ParsedArgument |> ActionInput < 'T>
44
44
45
45
/// Gets the value of an Option or Argument from the Parser.
46
46
member this.GetValue ( parseResult : ParseResult ) =
@@ -52,47 +52,47 @@ type HandlerInput<'T>(inputType: HandlerInputSource) =
52
52
module Input =
53
53
54
54
let context =
55
- HandlerInput < ActionContext>( Context)
55
+ ActionInput < ActionContext>( Context)
56
56
57
57
let option < 'T > ( name : string ) =
58
- Option< 'T>( name) |> HandlerInput .OfOption
58
+ Option< 'T>( name) |> ActionInput .OfOption
59
59
60
- let editOption ( edit : Option < 'T > -> unit ) ( hi : HandlerInput < 'T >) =
60
+ let editOption ( edit : Option < 'T > -> unit ) ( hi : ActionInput < 'T >) =
61
61
match hi.Source with
62
62
| ParsedOption o -> o :?> Option< 'T> |> edit
63
63
| _ -> ()
64
64
hi
65
65
66
- let editArgument ( edit : Argument < 'T > -> unit ) ( hi : HandlerInput < 'T >) =
66
+ let editArgument ( edit : Argument < 'T > -> unit ) ( hi : ActionInput < 'T >) =
67
67
match hi.Source with
68
68
| ParsedArgument a -> a :?> Argument< 'T> |> edit
69
69
| _ -> ()
70
70
hi
71
71
72
- let aliases ( aliases : string seq ) ( hi : HandlerInput < 'T >) =
72
+ let aliases ( aliases : string seq ) ( hi : ActionInput < 'T >) =
73
73
hi |> editOption ( fun o -> aliases |> Seq.iter o.Aliases.Add)
74
74
75
- let alias ( alias : string ) ( hi : HandlerInput < 'T >) =
75
+ let alias ( alias : string ) ( hi : ActionInput < 'T >) =
76
76
hi |> editOption ( fun o -> o.Aliases.Add alias)
77
77
78
- let desc ( description : string ) ( hi : HandlerInput < 'T >) =
78
+ let desc ( description : string ) ( hi : ActionInput < 'T >) =
79
79
hi
80
80
|> editOption ( fun o -> o.Description <- description)
81
81
|> editArgument ( fun a -> a.Description <- description)
82
82
83
- let defaultValue ( defaultValue : 'T ) ( hi : HandlerInput < 'T >) =
83
+ let defaultValue ( defaultValue : 'T ) ( hi : ActionInput < 'T >) =
84
84
hi
85
85
|> editOption ( fun o -> o.DefaultValueFactory <- ( fun _ -> defaultValue))
86
86
|> editArgument ( fun a -> a.DefaultValueFactory <- ( fun _ -> defaultValue))
87
87
88
88
let def = defaultValue
89
89
90
- let defFactory ( defaultValueFactory : Parsing.ArgumentResult -> 'T ) ( hi : HandlerInput < 'T >) =
90
+ let defFactory ( defaultValueFactory : Parsing.ArgumentResult -> 'T ) ( hi : ActionInput < 'T >) =
91
91
hi
92
92
|> editOption ( fun o -> o.DefaultValueFactory <- defaultValueFactory)
93
93
|> editArgument ( fun a -> a.DefaultValueFactory <- defaultValueFactory)
94
94
95
- let required ( hi : HandlerInput < 'T >) =
95
+ let required ( hi : ActionInput < 'T >) =
96
96
hi |> editOption ( fun o -> o.Required <- true )
97
97
98
98
let optionMaybe < 'T > ( name : string ) =
@@ -107,11 +107,11 @@ module Input =
107
107
)
108
108
o.Arity <- ArgumentArity( 0 , 1 )
109
109
o.DefaultValueFactory <- ( fun _ -> None)
110
- HandlerInput .OfOption< 'T option> o
110
+ ActionInput .OfOption< 'T option> o
111
111
112
112
let argument < 'T > ( name : string ) =
113
113
let a = Argument< 'T>( name)
114
- HandlerInput .OfArgument< 'T> a
114
+ ActionInput .OfArgument< 'T> a
115
115
116
116
let argumentMaybe < 'T > ( name : string ) =
117
117
let a = Argument< 'T option>( name)
@@ -122,104 +122,104 @@ module Input =
122
122
| [ token ] -> MaybeParser.parseTokenValue token.Value
123
123
| _ :: _ -> failwith " F# Option can only be used with a single argument."
124
124
)
125
- HandlerInput .OfArgument< 'T option> a
125
+ ActionInput .OfArgument< 'T option> a
126
126
127
127
let ofOption ( o : Option < 'T >) =
128
- HandlerInput .OfOption< 'T> o
128
+ ActionInput .OfOption< 'T> o
129
129
130
130
let ofArgument ( a : Argument < 'T >) =
131
- HandlerInput .OfArgument< 'T> a
131
+ ActionInput .OfArgument< 'T> a
132
132
133
133
/// Creates CLI options and arguments to be passed as command `inputs`.
134
134
type Input =
135
135
136
136
/// Converts a System.CommandLine.Option<'T> for usage with the CommandBuilder.
137
137
[<Obsolete( " Use Input.ofOption instead" ) >]
138
- static member OfOption < 'T >( o : Option < 'T >) : HandlerInput < 'T > =
138
+ static member OfOption < 'T >( o : Option < 'T >) : ActionInput < 'T > =
139
139
invalidOp " This method has been removed."
140
140
141
141
/// Converts a System.CommandLine.Argument<'T> for usage with the CommandBuilder.
142
142
[<Obsolete( " Use Input.ofArgument instead" ) >]
143
- static member OfArgument < 'T >( a : Argument < 'T >) : HandlerInput < 'T > =
143
+ static member OfArgument < 'T >( a : Argument < 'T >) : ActionInput < 'T > =
144
144
invalidOp " This method has been removed."
145
145
146
146
/// Creates a CLI option of type 'T with the ability to manually configure the underlying properties.
147
147
[<Obsolete " Use Input.option instead." >]
148
- static member Option < 'T >( name : string , configure : Option < 'T > -> unit ) : HandlerInput < 'T > =
148
+ static member Option < 'T >( name : string , configure : Option < 'T > -> unit ) : ActionInput < 'T > =
149
149
invalidOp " This method has been removed."
150
150
151
151
/// Creates a CLI option of type 'T with the ability to manually configure the underlying properties.
152
152
[<Obsolete " Use Input.option instead." >]
153
- static member Option < 'T >( aliases : string seq , configure : Option < 'T > -> unit ) : HandlerInput < 'T > =
153
+ static member Option < 'T >( aliases : string seq , configure : Option < 'T > -> unit ) : ActionInput < 'T > =
154
154
invalidOp " This method has been removed."
155
155
156
156
/// Creates a CLI argument of type 'T with the ability to manually configure the underlying properties.
157
157
[<Obsolete " Use Input.argument instead." >]
158
- static member Argument < 'T >( name : string , configure : Argument < 'T > -> unit ) : HandlerInput < 'T > =
158
+ static member Argument < 'T >( name : string , configure : Argument < 'T > -> unit ) : ActionInput < 'T > =
159
159
invalidOp " This method has been removed."
160
160
161
161
/// Creates a CLI option of type 'T.
162
162
[<Obsolete " Use Input.option instead." >]
163
- static member Option < 'T >( name : string , ? description : string ) : HandlerInput < 'T > =
163
+ static member Option < 'T >( name : string , ? description : string ) : ActionInput < 'T > =
164
164
invalidOp " This method has been removed."
165
165
166
166
/// Creates a CLI option of type 'T.
167
167
[<Obsolete " Use Input.option instead." >]
168
- static member Option < 'T >( aliases : string seq , ? description : string ) : HandlerInput < 'T > =
168
+ static member Option < 'T >( aliases : string seq , ? description : string ) : ActionInput < 'T > =
169
169
invalidOp " This method has been removed."
170
170
171
171
/// Creates a CLI option of type 'T with a default value.
172
172
[<Obsolete " Use Input.option instead." >]
173
- static member Option < 'T >( name : string , defaultValue : 'T , ? description : string ) : HandlerInput < 'T > =
173
+ static member Option < 'T >( name : string , defaultValue : 'T , ? description : string ) : ActionInput < 'T > =
174
174
invalidOp " This method has been removed."
175
175
176
176
/// Creates a CLI option of type 'T with a default value.
177
177
[<Obsolete " Use Input.option instead." >]
178
- static member Option < 'T >( aliases : string seq , defaultValue : 'T , ? description : string ) : HandlerInput < 'T > =
178
+ static member Option < 'T >( aliases : string seq , defaultValue : 'T , ? description : string ) : ActionInput < 'T > =
179
179
invalidOp " This method has been removed."
180
180
181
181
/// Creates a CLI option of type 'T that is required.
182
182
[<Obsolete " Use Input.option + Input.required instead." >]
183
- static member OptionRequired < 'T >( aliases : string seq , ? description : string ) : HandlerInput < 'T > =
183
+ static member OptionRequired < 'T >( aliases : string seq , ? description : string ) : ActionInput < 'T > =
184
184
invalidOp " This method has been removed."
185
185
186
186
/// Creates a CLI option of type 'T that is required.
187
187
[<Obsolete " Use Input.option + Input.required instead." >]
188
- static member OptionRequired < 'T >( name : string , ? description : string ) : HandlerInput < 'T > =
188
+ static member OptionRequired < 'T >( name : string , ? description : string ) : ActionInput < 'T > =
189
189
invalidOp " This method has been removed."
190
190
191
191
/// Creates a CLI option of type 'T option with the ability to manually configure the underlying properties.
192
192
[<Obsolete " Use Input.optionMaybe instead." >]
193
- static member OptionMaybe < 'T >( aliases : string seq , configure : Option < 'T option > -> unit ) : HandlerInput < 'T option > =
193
+ static member OptionMaybe < 'T >( aliases : string seq , configure : Option < 'T option > -> unit ) : ActionInput < 'T option > =
194
194
invalidOp " This method has been removed."
195
195
196
196
/// Creates a CLI option of type 'T option with the ability to manually configure the underlying properties.
197
197
[<Obsolete " Use Input.optionMaybe instead." >]
198
- static member OptionMaybe < 'T >( name : string , configure : Option < 'T option > -> unit ) : HandlerInput < 'T option > =
198
+ static member OptionMaybe < 'T >( name : string , configure : Option < 'T option > -> unit ) : ActionInput < 'T option > =
199
199
invalidOp " This method has been removed."
200
200
201
201
/// Creates a CLI option of type 'T option.
202
202
[<Obsolete " Use Input.optionMaybe instead." >]
203
- static member OptionMaybe < 'T >( aliases : string seq , ? description : string ) : HandlerInput < 'T option > =
203
+ static member OptionMaybe < 'T >( aliases : string seq , ? description : string ) : ActionInput < 'T option > =
204
204
invalidOp " This method has been removed."
205
205
206
206
/// Creates a CLI option of type 'T option.
207
- static member OptionMaybe < 'T >( name : string , ? description : string ) : HandlerInput < 'T option > =
207
+ static member OptionMaybe < 'T >( name : string , ? description : string ) : ActionInput < 'T option > =
208
208
invalidOp " This method has been removed."
209
209
210
210
/// Creates a CLI argument of type 'T.
211
211
[<Obsolete " Use Input.argument instead." >]
212
- static member Argument < 'T >( name : string , ? description : string ) : HandlerInput < 'T > =
212
+ static member Argument < 'T >( name : string , ? description : string ) : ActionInput < 'T > =
213
213
invalidOp " This method has been removed."
214
214
215
215
/// Creates a CLI argument of type 'T with a default value.
216
216
[<Obsolete " Use Input.argument instead." >]
217
- static member Argument < 'T >( name : string , defaultValue : 'T , ? description : string ) : HandlerInput < 'T > =
217
+ static member Argument < 'T >( name : string , defaultValue : 'T , ? description : string ) : ActionInput < 'T > =
218
218
invalidOp " This method has been removed."
219
219
220
220
/// Creates a CLI argument of type 'T option.
221
221
[<Obsolete " Use Input.argumentMaybe instead." >]
222
- static member ArgumentMaybe < 'T >( name : string , ? description : string ) : HandlerInput < 'T option > =
222
+ static member ArgumentMaybe < 'T >( name : string , ? description : string ) : ActionInput < 'T option > =
223
223
invalidOp " This method has been removed."
224
224
225
225
/// Passes the `InvocationContext` to the handler.
0 commit comments