@@ -10,13 +10,13 @@ namespace System.CommandLine;
10
10
public partial class Pipeline
11
11
{
12
12
// TODO: Consider more phases that have obvious meanings, like first and last
13
- private PipelinePhase diagramPhase = new ( SubsystemKind . Diagram ) ;
14
- private PipelinePhase completionPhase = new ( SubsystemKind . Completion ) ;
15
- private PipelinePhase helpPhase = new ( SubsystemKind . Help ) ;
16
- private PipelinePhase versionPhase = new ( SubsystemKind . Version ) ;
17
- private PipelinePhase validationPhase = new ( SubsystemKind . Validation ) ;
18
- private PipelinePhase invocationPhase = new ( SubsystemKind . Invocation ) ;
19
- private PipelinePhase errorReportingPhase = new ( SubsystemKind . ErrorReporting ) ;
13
+ private PipelinePhase < DiagramSubsystem > diagramPhase = new ( SubsystemKind . Diagram ) ;
14
+ private PipelinePhase < CompletionSubsystem > completionPhase = new ( SubsystemKind . Completion ) ;
15
+ private PipelinePhase < HelpSubsystem > helpPhase = new ( SubsystemKind . Help ) ;
16
+ private PipelinePhase < VersionSubsystem > versionPhase = new ( SubsystemKind . Version ) ;
17
+ private PipelinePhase < ValidationSubsystem > validationPhase = new ( SubsystemKind . Validation ) ;
18
+ private PipelinePhase < InvocationSubsystem > invocationPhase = new ( SubsystemKind . Invocation ) ;
19
+ private PipelinePhase < ErrorReportingSubsystem > errorReportingPhase = new ( SubsystemKind . ErrorReporting ) ;
20
20
// TODO: Consider this naming as it sounds like it is a finishing phase
21
21
private readonly IEnumerable < PipelinePhase > phases = [ ] ;
22
22
@@ -129,107 +129,55 @@ public void AddSubsystem(CliSubsystem subsystem, PhaseTiming timing = PhaseTimin
129
129
/// </summary>
130
130
public DiagramSubsystem ? Diagram
131
131
{
132
- get
133
- => diagramPhase . Subsystem switch
134
- {
135
- null => null ,
136
- DiagramSubsystem diagramSubsystem => diagramSubsystem ,
137
- _ => throw new InvalidOperationException ( "Version subsystem is not of the correct type" )
138
- } ;
139
- set
140
- {
141
- diagramPhase . Subsystem = value ;
142
- }
132
+ get => diagramPhase . Subsystem ;
133
+ set => diagramPhase . Subsystem = value ;
143
134
}
144
135
145
136
/// <summary>
146
137
/// Sets or gets the completion subsystem.
147
138
/// </summary>
148
139
public CompletionSubsystem ? Completion
149
140
{
150
- get
151
- => completionPhase . Subsystem switch
152
- {
153
- null => null ,
154
- CompletionSubsystem completionSubsystem => completionSubsystem ,
155
- _ => throw new InvalidOperationException ( "Version subsystem is not of the correct type" )
156
- } ;
157
- set
158
- {
159
- completionPhase . Subsystem = value ;
160
- }
141
+ get => completionPhase . Subsystem ;
142
+ set => completionPhase . Subsystem = value ;
143
+
161
144
}
162
145
163
146
/// <summary>
164
147
/// Sets or gets the help subsystem.
165
148
/// </summary>
166
149
public HelpSubsystem ? Help
167
150
{
168
- get
169
- => helpPhase . Subsystem switch
170
- {
171
- null => null ,
172
- HelpSubsystem helpSubsystem => helpSubsystem ,
173
- _ => throw new InvalidOperationException ( "Version subsystem is not of the correct type" )
174
- } ;
175
- set
176
- {
177
- helpPhase . Subsystem = value ;
178
- }
151
+ get => helpPhase . Subsystem ;
152
+ set => helpPhase . Subsystem = value ;
153
+
179
154
}
180
155
181
156
/// <summary>
182
157
/// Sets or gets the version subsystem.
183
158
/// </summary>
184
159
public VersionSubsystem ? Version
185
160
{
186
- get
187
- => versionPhase . Subsystem switch
188
- {
189
- null => null ,
190
- VersionSubsystem versionSubsystem => versionSubsystem ,
191
- _ => throw new InvalidOperationException ( "Version subsystem is not of the correct type" )
192
- } ;
193
- set
194
- {
195
- versionPhase . Subsystem = value ;
196
- }
161
+ get => versionPhase . Subsystem ;
162
+ set => versionPhase . Subsystem = value ;
197
163
}
198
164
199
165
/// <summary>
200
166
/// Sets or gets the error reporting subsystem.
201
167
/// </summary>
202
168
public ErrorReportingSubsystem ? ErrorReporting
203
169
{
204
- get
205
- => errorReportingPhase . Subsystem switch
206
- {
207
- null => null ,
208
- ErrorReportingSubsystem errorReportingSubsystem => errorReportingSubsystem ,
209
- _ => throw new InvalidOperationException ( "Version subsystem is not of the correct type" )
210
- } ;
211
- set
212
- {
213
- errorReportingPhase . Subsystem = value ;
214
- }
170
+ get => errorReportingPhase . Subsystem ;
171
+ set => errorReportingPhase . Subsystem = value ;
215
172
}
216
173
217
174
/// <summary>
218
175
/// Sets or gets the validation subsystem
219
176
/// </summary>
220
177
public ValidationSubsystem ? Validation
221
178
{
222
- get
223
- => validationPhase . Subsystem switch
224
- {
225
- null => null ,
226
- ValidationSubsystem validationSubsystem => validationSubsystem ,
227
- _ => throw new InvalidOperationException ( "Version subsystem is not of the correct type" )
228
- } ;
229
- set
230
- {
231
- validationPhase . Subsystem = value ;
232
- }
179
+ get => validationPhase . Subsystem ;
180
+ set => validationPhase . Subsystem = value ;
233
181
}
234
182
235
183
@@ -238,17 +186,8 @@ public ValidationSubsystem? Validation
238
186
/// </summary>
239
187
public InvocationSubsystem ? Invocation
240
188
{
241
- get
242
- => invocationPhase . Subsystem switch
243
- {
244
- null => null ,
245
- InvocationSubsystem invocationSubsystem => invocationSubsystem ,
246
- _ => throw new InvalidOperationException ( "Version subsystem is not of the correct type" )
247
- } ;
248
- set
249
- {
250
- invocationPhase . Subsystem = value ;
251
- }
189
+ get => invocationPhase . Subsystem ;
190
+ set => invocationPhase . Subsystem = value ;
252
191
}
253
192
254
193
0 commit comments