You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This command would return the optional features that are available in PowerShell. The default output format would be of type table with the properties `Name`, `Enabled`, `Source`, and `Description`. All of those properties would be of type string except for `Enabled`, which would be an enumeration with the possible values of `NotEnabled`, `Session`, `Manifest`, and `Script`. This differs from experimental features where `Enabled` is a boolean value. Given the locations in which an optional feature can be enabled, it would be more informative to identify where it is enabled than simply showing `$true` or `$false`.
140
+
This command would return the optional features that are available in PowerShell. The default output format would be of type table with the properties `Name`, `Source`, and `Description`, and with the results grouped by the value of the `EnableIn` property. All of those properties would be of type string except for `EnabledIn`, which would be an enumeration with the possible values of `NotEnabled`, `Session`, `Manifest`, `Script`, and `Scope`. This differs from experimental features where `Enabled` is a boolean value. Given the locations in which an optional feature can be enabled, it would be more informative to identify where it is enabled than simply showing `$true` or `$false`. The enumeration values have the following meaning:
141
+
142
+
|Value|Description|How to set the feature up this way|
143
+
|--|--|--|
144
+
|NotEnabled|The optional feature is not enabled at all|Disable-OptionalFeature command|
145
+
|Session|The optional feature is enabled by default in all PowerShell sessions|Enable-OptionalFeature command|
146
+
|Manifest|The optional feature is enabled in the manifest for the current module|OptionalFeatures entry in module manifest|
147
+
|Script|The optional feature is enabled in the current script|#requires entry in script file|
148
+
|Scope|The optional feature is enabled the current scope|Use-OptionalFeature command|
132
149
133
150
### New command: Enable-OptionalFeature
134
151
@@ -163,3 +180,7 @@ Experimental features and optional features are very similar to one another, so
163
180
### Supporting a `-Scope` parameter like the experimental feature cmdlets do
164
181
165
182
The `Enable-OptionalFeature` and `Disable-OptionalFeature` cmdlets could support a `-Scope` parameter like their experimental feature cmdlet counterparts do. I felt it was better to remove this for optional features, because it may be risky to allow a command to enable an optional feature in a scope above the one in which it is invoked, influencing behaviour elsewhere.
183
+
184
+
### Allow optional features to be disabled at a certain level
185
+
186
+
Certain optional features may be so important that PowerShell should be installed with them to be on by default. In cases where this happens, scripters should be able to indicate that they want the opposite behaviour in a script file or module, so that they can ensure any compatibility issues are addressed before the feature is enabled in that module/script. With this in mind, we could either allow optional features to be disabled at a certain level, or stick with enable only, inversing how the optional feature is designed such that turning it on effectively disables a breaking fix that was deemed important enough to have fixed by default.
Copy file name to clipboardExpand all lines: 1-Draft/RFCNNNN-Propagate-Execution-Preferences-Beyond-Module-Scope.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,6 +128,8 @@ As per the optional feature specification, the optional feature can be enabled i
128
128
129
129
[Some members of the community](https://github.com/PowerShell/PowerShell/issues/6745#issuecomment-499740080) feel it would better to break compatibility here. On the plus side, not having to deal with this an an optional parameter would be ideal; however, to increase adoption of PowerShell 7, it would be better to make the transition from PowerShell 5.1 into 7 easier by having as few breaking changes as possible.
130
130
131
+
One way to achieve this while supporting users who don't want the breaking change would be to inverse the optional feature, where the breaking change is in place and users opt out of the breaking change instead of opting into it. Another way would be to change the optional feature design such that users can turn them off in scripts/modules if those scripts/modules are not ready to use the breaking change. See the alternate proposals and considerations section of RFCNNNN-Optional-Features for more information.
132
+
131
133
### Support `-DebugAction`, `-VerboseAction`, and `-ProgressAction` if those common parameters are added
132
134
133
135
RFCNNNN-ScriptBlock-Action-Preference suggests that we consider adding `-DebugAction`, `-VerboseAction`, and `-ProgressAction` common parameters. These are important to consider adding, because beyond the `-Debug` and `-Verbose` switch common parameters (which only support `ActionPreference.Continue`), the new common parameters would be the only way to propagate execution preferences for debug, verbose, and progress messages to all commands that are invoked. See RFCNNNN-ScriptBlock-Action-Preference for more details.
0 commit comments