Process the arguments for a command resource's get operation. # Arguments `args` - The Get arguments to process `value` - The value to use for JSON input arguments # Returns A vector of strings representing the processed arguments
(args: Option<&Vec<GetArgKind>>, input: &str, command_resource_info: &CommandResourceInfo)
| 940 | /// |
| 941 | /// A vector of strings representing the processed arguments |
| 942 | pub fn process_get_args(args: Option<&Vec<GetArgKind>>, input: &str, command_resource_info: &CommandResourceInfo) -> Option<Vec<String>> { |
| 943 | let Some(arg_values) = args else { |
| 944 | debug!("{}", t!("dscresources.commandResource.noArgs")); |
| 945 | return None; |
| 946 | }; |
| 947 | |
| 948 | let mut processed_args = Vec::<String>::new(); |
| 949 | for arg in arg_values { |
| 950 | match arg { |
| 951 | GetArgKind::String(s) => { |
| 952 | processed_args.push(s.clone()); |
| 953 | }, |
| 954 | GetArgKind::Json { json_input_arg, mandatory } => { |
| 955 | if input.is_empty() && *mandatory != Some(true) { |
| 956 | continue; |
| 957 | } |
| 958 | |
| 959 | processed_args.push(json_input_arg.clone()); |
| 960 | processed_args.push(input.to_string()); |
| 961 | }, |
| 962 | GetArgKind::ResourceType { resource_type_arg } => { |
| 963 | processed_args.push(resource_type_arg.clone()); |
| 964 | processed_args.push(command_resource_info.type_name.to_string()); |
| 965 | }, |
| 966 | GetArgKind::ResourcePath { resource_path_arg, include_quotes} => { |
| 967 | if let Some(path) = &command_resource_info.path { |
| 968 | processed_args.push(resource_path_arg.clone()); |
| 969 | if *include_quotes { |
| 970 | processed_args.push(format!("\"{}\"", path.to_string_lossy())); |
| 971 | } else { |
| 972 | processed_args.push(path.to_string_lossy().to_string()); |
| 973 | } |
| 974 | } |
| 975 | }, |
| 976 | } |
| 977 | } |
| 978 | |
| 979 | Some(processed_args) |
| 980 | } |
| 981 | |
| 982 | fn process_schema_args(args: Option<&Vec<SchemaArgKind>>, command_resource_info: &CommandResourceInfo) -> Option<Vec<String>> { |
| 983 | let Some(arg_values) = args else { |
no test coverage detected