@@ -367,11 +367,17 @@ pub fn parse_input_to_json(value: &str) -> String {
367367pub fn get_input ( input : & Option < String > , stdin : & Option < String > , path : & Option < String > ) -> String {
368368 let value = match ( input, stdin, path) {
369369 ( Some ( _) , Some ( _) , None ) | ( None , Some ( _) , Some ( _) ) => {
370- error ! ( "Error: Cannot specify both stdin and --input or --path" ) ;
370+ error ! ( "Error: Cannot specify both stdin and --document or --path" ) ;
371371 exit ( EXIT_INVALID_ARGS ) ;
372372 } ,
373373 ( Some ( input) , None , None ) => {
374374 debug ! ( "Reading input from command line parameter" ) ;
375+
376+ // see if user accidentally passed in a file path
377+ if Path :: new ( input) . exists ( ) {
378+ error ! ( "Error: Document provided is a file path, use --path instead" ) ;
379+ exit ( EXIT_INVALID_INPUT ) ;
380+ }
375381 input. clone ( )
376382 } ,
377383 ( None , Some ( stdin) , None ) => {
@@ -413,7 +419,7 @@ pub fn get_input(input: &Option<String>, stdin: &Option<String>, path: &Option<S
413419///
414420/// # Arguments
415421///
416- /// * `config_path` - Full path to the config file
422+ /// * `config_path` - Full path to the config file
417423///
418424/// # Returns
419425///
@@ -428,14 +434,14 @@ pub fn set_dscconfigroot(config_path: &str) -> String
428434 exit ( EXIT_DSC_ERROR ) ;
429435 } ;
430436
431- let Some ( config_root_path) = full_path. parent ( ) else {
437+ let Some ( config_root_path) = full_path. parent ( ) else {
432438 // this should never happen because path was absolutized
433439 error ! ( "Error reading config path parent" ) ;
434440 exit ( EXIT_DSC_ERROR ) ;
435441 } ;
436442
437443 let env_var = "DSC_CONFIG_ROOT" ;
438-
444+
439445 // warn if env var is already set/used
440446 if env:: var ( env_var) . is_ok ( ) {
441447 warn ! ( "The current value of '{env_var}' env var will be overridden" ) ;
0 commit comments