Skip to content

Commit 6cb838a

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
address Mikey's comment to use serde default instead of option
1 parent 656db04 commit 6cb838a

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/dsc-lib/src/dscresources/command_resource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ pub fn process_get_args(args: Option<&Vec<GetArgKind>>, input: &str, command_res
964964
GetArgKind::ResourcePath { resource_path_arg, include_quotes} => {
965965
if let Some(path) = &command_resource_info.path {
966966
processed_args.push(resource_path_arg.clone());
967-
if include_quotes.unwrap_or(false) {
967+
if *include_quotes {
968968
processed_args.push(format!("\"{}\"", path.to_string_lossy()));
969969
} else {
970970
processed_args.push(path.to_string_lossy().to_string());
@@ -1033,7 +1033,7 @@ fn process_set_delete_args(args: Option<&Vec<SetDeleteArgKind>>, input: &str, co
10331033
SetDeleteArgKind::ResourcePath { resource_path_arg, include_quotes} => {
10341034
if let Some(path) = &command_resource_info.path {
10351035
processed_args.push(resource_path_arg.clone());
1036-
if include_quotes.unwrap_or(false) {
1036+
if *include_quotes {
10371037
processed_args.push(format!("\"{}\"", path.to_string_lossy()));
10381038
} else {
10391039
processed_args.push(path.to_string_lossy().to_string());

lib/dsc-lib/src/dscresources/resource_manifest.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,17 @@ pub enum GetArgKind {
112112
/// Indicates if argument is mandatory which will pass an empty string if no JSON input is provided. Default is false.
113113
mandatory: Option<bool>,
114114
},
115+
#[serde(rename_all = "camelCase")]
115116
ResourcePath {
116117
/// The argument that accepts the resource path.
117-
#[serde(rename = "resourcePathArg")]
118118
resource_path_arg: String,
119119
/// Indicates if the argument should be wrapped in quotes. Default is false.
120-
#[serde(rename = "includeQuotes")]
121-
include_quotes: Option<bool>,
120+
#[serde(default)]
121+
include_quotes: bool,
122122
},
123+
#[serde(rename_all = "camelCase")]
123124
ResourceType {
124125
/// The argument that accepts the resource type name.
125-
#[serde(rename = "resourceTypeArg")]
126126
resource_type_arg: String,
127127
},
128128
}
@@ -141,23 +141,23 @@ pub enum SetDeleteArgKind {
141141
/// Indicates if argument is mandatory which will pass an empty string if no JSON input is provided. Default is false.
142142
mandatory: Option<bool>,
143143
},
144+
#[serde(rename_all = "camelCase")]
144145
ResourcePath {
145146
/// The argument that accepts the resource path.
146-
#[serde(rename = "resourcePathArg")]
147147
resource_path_arg: String,
148148
/// Indicates if the resource path should be passed with quotes. Default is false.
149-
#[serde(rename = "includeQuotes")]
150-
include_quotes: Option<bool>,
149+
#[serde(default)]
150+
include_quotes: bool,
151151
},
152+
#[serde(rename_all = "camelCase")]
152153
ResourceType {
153154
/// The argument that accepts the resource type name.
154-
#[serde(rename = "resourceTypeArg")]
155155
resource_type_arg: String,
156156
},
157157
/// The argument is passed when the resource is invoked in what-if mode.
158+
#[serde(rename_all = "camelCase")]
158159
WhatIf {
159160
/// The argument to pass when in what-if mode.
160-
#[serde(rename = "whatIfArg")]
161161
what_if_arg: String,
162162
}
163163
}

0 commit comments

Comments
 (0)