@@ -6,12 +6,23 @@ use crate::resolve::{get_contents, Include};
6
6
use crate :: resource_command:: { get_resource, self } ;
7
7
use crate :: tablewriter:: Table ;
8
8
use crate :: util:: { DSC_CONFIG_ROOT , EXIT_DSC_ERROR , EXIT_INVALID_ARGS , EXIT_INVALID_INPUT , EXIT_JSON_ERROR , get_schema, write_output, get_input, set_dscconfigroot, validate_json} ;
9
- use dsc_lib:: configure:: { Configurator , config_doc:: { Configuration , ExecutionKind , Resource } } ;
10
- use dsc_lib:: dscerror:: DscError ;
11
- use dsc_lib:: dscresources:: invoke_result:: { ResolveResult , TestResult } ;
12
9
use dsc_lib:: {
10
+ configure:: {
11
+ config_doc:: {
12
+ Configuration ,
13
+ ExecutionKind ,
14
+ Resource ,
15
+ } ,
16
+ config_result:: ResourceGetResult ,
17
+ Configurator ,
18
+ } ,
19
+ dscerror:: DscError ,
13
20
DscManager ,
14
- dscresources:: invoke_result:: ValidateResult ,
21
+ dscresources:: invoke_result:: {
22
+ ResolveResult ,
23
+ TestResult ,
24
+ ValidateResult ,
25
+ } ,
15
26
dscresources:: dscresource:: { Capability , ImplementedAs , Invoke } ,
16
27
dscresources:: resource_manifest:: { import_manifest, ResourceManifest } ,
17
28
} ;
@@ -93,7 +104,7 @@ pub fn config_set(configurator: &mut Configurator, format: &Option<OutputFormat>
93
104
}
94
105
}
95
106
96
- pub fn config_test ( configurator : & mut Configurator , format : & Option < OutputFormat > , as_group : & bool , as_test : & bool )
107
+ pub fn config_test ( configurator : & mut Configurator , format : & Option < OutputFormat > , as_group : & bool , as_get : & bool , as_test : & bool )
97
108
{
98
109
match configurator. invoke_test ( ) {
99
110
Ok ( result) => {
@@ -134,6 +145,19 @@ pub fn config_test(configurator: &mut Configurator, format: &Option<OutputFormat
134
145
}
135
146
}
136
147
}
148
+ else if * as_get {
149
+ let mut group_result = Vec :: < ResourceGetResult > :: new ( ) ;
150
+ for test_result in result. results {
151
+ group_result. push ( test_result. into ( ) ) ;
152
+ }
153
+ match serde_json:: to_string ( & group_result) {
154
+ Ok ( json) => json,
155
+ Err ( err) => {
156
+ error ! ( "JSON Error: {err}" ) ;
157
+ exit ( EXIT_JSON_ERROR ) ;
158
+ }
159
+ }
160
+ }
137
161
else {
138
162
match serde_json:: to_string ( & ( result. results ) ) {
139
163
Ok ( json) => json,
@@ -317,8 +341,8 @@ pub fn config(subcommand: &ConfigSubCommand, parameters: &Option<String>, mounte
317
341
ConfigSubCommand :: Set { format, .. } => {
318
342
config_set ( & mut configurator, format, as_group) ;
319
343
} ,
320
- ConfigSubCommand :: Test { format, as_test, .. } => {
321
- config_test ( & mut configurator, format, as_group, as_test) ;
344
+ ConfigSubCommand :: Test { format, as_get , as_test, .. } => {
345
+ config_test ( & mut configurator, format, as_group, as_get , as_test) ;
322
346
} ,
323
347
ConfigSubCommand :: Validate { document, path, format} => {
324
348
let mut result = ValidateResult {
0 commit comments