Skip to content

Commit 272abb7

Browse files
committed
add aliases to --what-if
1 parent 63c868b commit 272abb7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

dsc/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub enum ConfigSubCommand {
126126
file: Option<String>,
127127
#[clap(short = 'o', long, help = t!("args.outputFormat").to_string())]
128128
output_format: Option<OutputFormat>,
129-
#[clap(short = 'w', long, help = t!("args.whatIf").to_string())]
129+
#[clap(short = 'w', long, visible_aliases = ["dry-run", "noop"], help = t!("args.whatIf").to_string())]
130130
what_if: bool,
131131
},
132132
#[clap(name = "test", about = t!("args.testAbout").to_string())]

dsc/tests/dsc_whatif.tests.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ Describe 'whatif tests' {
8888
$LASTEXITCODE | Should -Be 0
8989
}
9090

91-
It 'what-if execution of WhatIf resource' {
91+
It 'what-if execution of WhatIf resource via <alias>' -TestCases @(
92+
@{ alias = '-w' }
93+
@{ alias = '--what-if' }
94+
@{ alias = '--dry-run' }
95+
@{ alias = '--noop' }
96+
) {
97+
param($alias)
9298
$config_yaml = @"
9399
`$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
94100
resources:
@@ -97,7 +103,7 @@ Describe 'whatif tests' {
97103
properties:
98104
executionType: Actual
99105
"@
100-
$result = $config_yaml | dsc config set -w -f - | ConvertFrom-Json
106+
$result = $config_yaml | dsc config set $alias -f - | ConvertFrom-Json
101107
$result.metadata.'Microsoft.DSC'.executionType | Should -BeExactly 'whatIf'
102108
$result.results.result.afterState.executionType | Should -BeExactly 'WhatIf'
103109
$result.results.result.changedProperties | Should -BeExactly 'executionType'

0 commit comments

Comments
 (0)