MCPcopy Create free account
hub / github.com/PowerShell/DSC / process_get_args

Function process_get_args

lib/dsc-lib/src/dscresources/command_resource.rs:942–980  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

940///
941/// A vector of strings representing the processed arguments
942pub 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
982fn process_schema_args(args: Option<&Vec<SchemaArgKind>>, command_resource_info: &CommandResourceInfo) -> Option<Vec<String>> {
983 let Some(arg_values) = args else {

Callers 7

invoke_getFunction · 0.85
invoke_setFunction · 0.85
invoke_testFunction · 0.85
invoke_validateFunction · 0.85
invoke_exportFunction · 0.85
invoke_resolveFunction · 0.85
discoverMethod · 0.85

Calls 2

newFunction · 0.50
is_emptyMethod · 0.45

Tested by

no test coverage detected