@@ -9,26 +9,33 @@ namespace System.CommandLine.Directives;
9
9
public class ResponseSubsystem ( )
10
10
: CliSubsystem ( "Response" , SubsystemKind . Response , null )
11
11
{
12
+ public bool Enabled { get ; set ; }
13
+
12
14
protected internal override void Initialize ( InitializationContext context )
13
15
=> context . Configuration . ResponseFileTokenReplacer = Replacer ;
14
16
15
- public static ( List < string > ? tokens , List < string > ? errors ) Replacer ( string responseSourceName )
17
+ public ( List < string > ? tokens , List < string > ? errors ) Replacer ( string responseSourceName )
16
18
{
17
- try
18
- {
19
- // TODO: Include checks from previous system.
20
- var contents = File . ReadAllText ( responseSourceName ) ;
21
- return ( CliParser . SplitCommandLine ( contents ) . ToList ( ) , null ) ;
22
- }
23
- catch
19
+ if ( Enabled )
24
20
{
25
- // TODO: Switch to proper errors
26
- return ( null ,
27
- errors :
28
- [
29
- $ "Failed to open response file { responseSourceName } "
30
- ] ) ;
21
+ try
22
+ {
23
+ // TODO: Include checks from previous system.
24
+ var contents = File . ReadAllText ( responseSourceName ) ;
25
+ return ( CliParser . SplitCommandLine ( contents ) . ToList ( ) , null ) ;
26
+ }
27
+ catch
28
+ {
29
+ // TODO: Switch to proper errors
30
+ return ( null ,
31
+ errors :
32
+ [
33
+ $ "Failed to open response file { responseSourceName } "
34
+ ] ) ;
35
+ }
31
36
}
37
+ // TODO: Confirm this is not an error state
38
+ return ( [ responseSourceName ] , null ) ;
32
39
}
33
40
34
41
// TODO: File handling from previous system - ensure these checks are done (note: no tests caught these oversights
0 commit comments