@@ -271,15 +271,16 @@ fn initialize_config_root(path: Option<&String>) -> Option<String> {
271271}
272272
273273#[ allow( clippy:: too_many_lines) ]
274- pub fn config ( subcommand : & ConfigSubCommand , parameters : & Option < String > , mounted_path : Option < & String > , as_group : & bool , as_assert : & bool , as_include : & bool , progress_format : ProgressFormat ) {
274+ #[ allow( clippy:: too_many_arguments) ]
275+ pub fn config ( subcommand : & ConfigSubCommand , parameters : & Option < String > , parameters_from_stdin : bool , mounted_path : Option < & String > , as_group : & bool , as_assert : & bool , as_include : & bool , progress_format : ProgressFormat ) {
275276 let ( new_parameters, json_string) = match subcommand {
276277 ConfigSubCommand :: Get { input, file, .. } |
277278 ConfigSubCommand :: Set { input, file, .. } |
278279 ConfigSubCommand :: Test { input, file, .. } |
279280 ConfigSubCommand :: Validate { input, file, .. } |
280281 ConfigSubCommand :: Export { input, file, .. } => {
281282 let new_path = initialize_config_root ( file. as_ref ( ) ) ;
282- let document = get_input ( input. as_ref ( ) , new_path. as_ref ( ) ) ;
283+ let document = get_input ( input. as_ref ( ) , new_path. as_ref ( ) , parameters_from_stdin ) ;
283284 if * as_include {
284285 let ( new_parameters, config_json) = match get_contents ( & document) {
285286 Ok ( ( parameters, config_json) ) => ( parameters, config_json) ,
@@ -295,7 +296,7 @@ pub fn config(subcommand: &ConfigSubCommand, parameters: &Option<String>, mounte
295296 } ,
296297 ConfigSubCommand :: Resolve { input, file, .. } => {
297298 let new_path = initialize_config_root ( file. as_ref ( ) ) ;
298- let document = get_input ( input. as_ref ( ) , new_path. as_ref ( ) ) ;
299+ let document = get_input ( input. as_ref ( ) , new_path. as_ref ( ) , parameters_from_stdin ) ;
299300 let ( new_parameters, config_json) = match get_contents ( & document) {
300301 Ok ( ( parameters, config_json) ) => ( parameters, config_json) ,
301302 Err ( err) => {
@@ -391,7 +392,7 @@ pub fn config(subcommand: &ConfigSubCommand, parameters: &Option<String>, mounte
391392 } ;
392393 if * as_include {
393394 let new_path = initialize_config_root ( file. as_ref ( ) ) ;
394- let input = get_input ( input. as_ref ( ) , new_path. as_ref ( ) ) ;
395+ let input = get_input ( input. as_ref ( ) , new_path. as_ref ( ) , parameters_from_stdin ) ;
395396 match serde_json:: from_str :: < Include > ( & input) {
396397 Ok ( _) => {
397398 // valid, so do nothing
@@ -582,40 +583,36 @@ pub fn resource(subcommand: &ResourceSubCommand, progress_format: ProgressFormat
582583 } ,
583584 ResourceSubCommand :: Export { resource, input, file, output_format } => {
584585 dsc. find_resources ( & [ resource. to_string ( ) ] , progress_format) ;
585- let parsed_input = get_input ( input. as_ref ( ) , file. as_ref ( ) ) ;
586+ let parsed_input = get_input ( input. as_ref ( ) , file. as_ref ( ) , false ) ;
586587 resource_command:: export ( & mut dsc, resource, & parsed_input, output_format. as_ref ( ) ) ;
587588 } ,
588589 ResourceSubCommand :: Get { resource, input, file : path, all, output_format } => {
589590 dsc. find_resources ( & [ resource. to_string ( ) ] , progress_format) ;
590- if * all { resource_command:: get_all ( & dsc, resource, output_format. as_ref ( ) ) ; }
591+ if * all {
592+ resource_command:: get_all ( & dsc, resource, output_format. as_ref ( ) ) ;
593+ }
591594 else {
592- let parsed_input = get_input ( input. as_ref ( ) , path. as_ref ( ) ) ;
593- let format = match output_format {
594- Some ( GetOutputFormat :: Json ) => Some ( OutputFormat :: Json ) ,
595- Some ( GetOutputFormat :: JsonArray ) => {
596- error ! ( "{}" , t!( "subcommand.jsonArrayNotSupported" ) ) ;
597- exit ( EXIT_INVALID_ARGS ) ;
598- } ,
599- Some ( GetOutputFormat :: PrettyJson ) => Some ( OutputFormat :: PrettyJson ) ,
600- Some ( GetOutputFormat :: Yaml ) => Some ( OutputFormat :: Yaml ) ,
601- None => None ,
602- } ;
603- resource_command:: get ( & dsc, resource, & parsed_input, format. as_ref ( ) ) ;
595+ if * output_format == Some ( GetOutputFormat :: JsonArray ) {
596+ error ! ( "{}" , t!( "subcommand.jsonArrayNotSupported" ) ) ;
597+ exit ( EXIT_INVALID_ARGS ) ;
598+ }
599+ let parsed_input = get_input ( input. as_ref ( ) , path. as_ref ( ) , false ) ;
600+ resource_command:: get ( & dsc, resource, & parsed_input, output_format. as_ref ( ) ) ;
604601 }
605602 } ,
606603 ResourceSubCommand :: Set { resource, input, file : path, output_format } => {
607604 dsc. find_resources ( & [ resource. to_string ( ) ] , progress_format) ;
608- let parsed_input = get_input ( input. as_ref ( ) , path. as_ref ( ) ) ;
605+ let parsed_input = get_input ( input. as_ref ( ) , path. as_ref ( ) , false ) ;
609606 resource_command:: set ( & dsc, resource, & parsed_input, output_format. as_ref ( ) ) ;
610607 } ,
611608 ResourceSubCommand :: Test { resource, input, file : path, output_format } => {
612609 dsc. find_resources ( & [ resource. to_string ( ) ] , progress_format) ;
613- let parsed_input = get_input ( input. as_ref ( ) , path. as_ref ( ) ) ;
610+ let parsed_input = get_input ( input. as_ref ( ) , path. as_ref ( ) , false ) ;
614611 resource_command:: test ( & dsc, resource, & parsed_input, output_format. as_ref ( ) ) ;
615612 } ,
616613 ResourceSubCommand :: Delete { resource, input, file : path } => {
617614 dsc. find_resources ( & [ resource. to_string ( ) ] , progress_format) ;
618- let parsed_input = get_input ( input. as_ref ( ) , path. as_ref ( ) ) ;
615+ let parsed_input = get_input ( input. as_ref ( ) , path. as_ref ( ) , false ) ;
619616 resource_command:: delete ( & dsc, resource, & parsed_input) ;
620617 } ,
621618 }
0 commit comments