Skip to content

Commit 0f5fe0e

Browse files
authored
rewrite shouldprocess suppression doc (#1529)
1 parent 225ac19 commit 0f5fe0e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/directives.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Some generated cmdlets include PowerShell `SupportsShouldProcess` semantics, exp
215215

216216
Use `suppress-should-process` to explicitly disable `SupportsShouldProcess` for selected cmdlets so that `-WhatIf` and `-Confirm` are not generated.
217217

218-
This directive was introduced to address scenarios like issue #704, where `listKeys` style operations were generated with unnecessary confirmation switches.
218+
This directive was introduced to address scenarios like issue [#704](https://github.com/Azure/autorest.powershell/issues/704), where `listKeys` style operations were generated with unnecessary confirmation switches.
219219

220220
Usage:
221221
- Target the cmdlet with the usual command filters (`verb`, `subject`, `subject-prefix`, and/or `variant`).
@@ -248,7 +248,7 @@ Notes:
248248
- Use sparingly; only when you are certain the underlying operation is non-mutating.
249249

250250
### Parameter Rename
251-
To select a parameter you need to provide the `parameter-name`. Furthermore, if you want to target specific cmdlets you can provide the `subject-prefix`, `subject`, `verb`, and/or `variant` (i.e. parameter-set name). For example:
251+
To select a parameter you need to provide the `parameter-name`. Furthermore, if you want to target specific cmdlets you can provide the `subject-prefix`, `subject`, `verb`, and/or `variant` (i.e. parameter-set). For example:
252252
```yaml false
253253
# This will rename the parameter 'XYZName' from the cmdlet 'Get-Operation' to 'Name'.
254254
directive:
@@ -349,7 +349,7 @@ directive:
349349
```
350350

351351
### Model Cmdlet
352-
To generate a cmdlet for a model facilitating users in constructing complex objects, you can choose the model using `model-name`. The default cmdlet name generated will be New-Az[subject-prefix][model-name]Object (or equivalent based on module naming). For example:
352+
To generate a cmdlet for a model facilitating users in constructing complex objects, you can choose the model using `model-name`. The default cmdlet name generated will be New-Az[subject-prefix][model-name]Object, and you can customize it using `cmdlet-name`. For example:
353353
```yaml $false
354354
- model-cmdlet:
355355
- model-name: Workspace
@@ -383,7 +383,7 @@ directive:
383383
```
384384

385385
### Alias Removal
386-
If the option `--sanitize-names` or `--azure` is provided, AutoRest will make renames to cmdlets and parameters to remove redundancies. For example in the command `Get-VirtualMachine`, the parameter `VirtualMachineName` may become just `Name`. To remove an automatically generated alias:
386+
If the option `--sanitize-names` or `--azure` is provided, AutoRest will make renames to cmdlets and parameters to remove redundancies. For example in the command `Get-VirtualMachine`, the parameter `VirtualMachineName` will be renamed to `Name`, and aliased to VirtualMachineName. It is possible to eliminate that alias by providing the action `clear-alias: true`:
387387
```yaml $false
388388
directive:
389389
- where:
@@ -393,7 +393,7 @@ directive:
393393
The same can be done with cmdlets.
394394

395395
### Table Formatting
396-
This allows you to set the *table format* for a model. This updates the `.format.ps1xml` to have the format described below as opposed to the automatic table format that is created at build-time. For example:
396+
This allows you to set the *table format* for a model. This updates the `.format.ps1xml` to have the format described below as opposed to the automatic table format that is created at build-time. For example, we are updating the format for a VirtualMachine model to only show the Name and ResourceGroup properties. It updates the column label for ResourceGroup to Resource Group and sets the columns widths for Name and ResourceGroup:
397397
```yaml $false
398398
directive:
399399
- where:
@@ -432,7 +432,7 @@ directive:
432432
```
433433

434434
### Argument Completers
435-
For parameters, you can declare argument completers that will allow you to tab through the values when entering that parameter interactively. This allows you to declare a PowerShell script that will run to produce the possible values for that parameter.
435+
For parameters, you can declare argument completers that will allow you to tab through the values when entering that parameter interactively. This allows you to declare a PowerShell script that will run to get the values for the completer. For example:
436436
```yaml $false
437437
# The script should return a list of values.
438438
directive:
@@ -447,7 +447,7 @@ directive:
447447
The name and description are optional. They are currently unused properties that may be used in documentation generation in the future.
448448

449449
### Default Values
450-
For parameters, you can declare a default value script that will run to set the value for the parameter if it is not provided. Once this is declared for a parameter, that parameter will be made optional (unless there are other constraints).
450+
For parameters, you can declare a default value script that will run to set the value for the parameter if it is not provided. Once this is declared for a parameter, that parameter will be made optional at build-time. For example:
451451
```yaml $false
452452
# The script should return a value for the parameter.
453453
directive:
@@ -463,7 +463,7 @@ The name and description are optional. They are currently unused properties that
463463

464464
### Polymorphism
465465

466-
In swagger, polymorphism is recognized as the `discriminator` keyword. The model with this keyword will be the **base class**, and the models that use `allOf` to referece the base class are the **child classes**.
466+
In swagger, polymorphism is recognized as the `discriminator` keyword. The model with this keyword will be the **base class**, and the models that use `allOf` to referece the base class are the **child class**.
467467

468468
We will use two directives to support polymorphism:
469469

0 commit comments

Comments
 (0)