Azure / Azure/autorest.powershell

Configuration for Force/ShouldContinue pattern

Open
#307 2 comments 0 reactions 0 assignees View on GitHub
feature-request P2
Dominant language
C#
Stars
123
Forks
99
PR merge metrics
No merged PRs in 30d

Description

Need a configuration option `AddForceParameter` with a configuration parameter `hasSecurityImpact` ($true or $false) to add Force/ShouldContinue pattern to generated cmdlets that implement ShouldProcess.

In the proposed pattern implementation, when this is activated, a `SwitchParameter` called `Force` is added to all parameter sets, and the cmdlet execution in `ProcessRecord` is changed as w follows:

```powershell
if (ShouldProcess(, )) {
if (Force.IsPresent || ShouldContinue("Perform the operation'' on ''?", "ShouldConfirm Prompt", , ref bool, ref bool)) {
ProcessRecordAsync()
...
}
}
```

This will always print the provided prompt, no matter what settings are selected.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.