Skip to content

Commit e5b476d

Browse files
committed
clean-up parameter names and use of scope
1 parent e162407 commit e5b476d

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

1-Draft/RFCNNNN-Optional-Features.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ As an example of a feature that will be optional if implemented, see RFCNNNN-Pro
2828
## Motivation
2929

3030
As a script, function, or module author,
31-
I can enable optional features in specific scopes,
31+
I can enable optional features for specific users or in specific scopes,
3232
so that I can leverage new functionality that may break existing scripts without risk.
3333

3434
## User experience
@@ -64,7 +64,7 @@ Get-OptionalFeatureConfiguration
6464
6565
# Output:
6666
#
67-
# Scope: AllUsers
67+
# For: AllUsers
6868
#
6969
# Name Session NewManifest
7070
# ---- ------ -----------
@@ -74,7 +74,7 @@ Get-OptionalFeatureConfiguration
7474
# OptionalFeature5 False False
7575
#
7676
#
77-
# Scope: CurrentUser
77+
# For: CurrentUser
7878
#
7979
# Name Session NewManifest
8080
# ---- ------ -----------
@@ -96,14 +96,14 @@ Get-OptionalFeature
9696
9797
# Enable an optional feature in current and future PowerShell sessions for all
9898
# users in PowerShell.
99-
Enable-OptionalFeature -Name OptionalFeature1 -UserScope AllUsers
99+
Enable-OptionalFeature -Name OptionalFeature1 -For AllUsers
100100
101101
# Output:
102102
# None
103103
104104
# Disable an optional feature in current and future PowerShell sessions for the
105105
# current user in PowerShell.
106-
Disable-OptionalFeature -Name OptionalFeature1 -UserScope CurrentUser
106+
Disable-OptionalFeature -Name OptionalFeature1 -For CurrentUser
107107
108108
# Output:
109109
# None, unless the feature was explicitly enabled for all users and is being
@@ -113,15 +113,15 @@ Disable-OptionalFeature -Name OptionalFeature1 -UserScope CurrentUser
113113
# Enable an optional feature in all new module manifests created with
114114
# New-ModuleManifest in the current and future PowerShell sessions for any user
115115
# in PowerShell.
116-
Enable-OptionalFeature -Name OptionalFeature2 -NewModuleManifests -UserScope AllUsers
116+
Enable-OptionalFeature -Name OptionalFeature2 -For AllUsers -InNewModuleManifests
117117
118118
# Output:
119119
# None
120120
121121
# Enable an optional feature in all new module manifests created with
122122
# New-ModuleManifest in the current and future PowerShell sessions for the
123123
# current user in PowerShell.
124-
Disable-OptionalFeature -Name OptionalFeature3 -NewModuleManifests
124+
Disable-OptionalFeature -Name OptionalFeature3 -InNewModuleManifests
125125
126126
# Output:
127127
# None
@@ -144,7 +144,7 @@ Unlike experimental features, which can only be enabled or disabled in PowerShel
144144

145145
Below you will find details describing how this functionality will be implemented.
146146

147-
### System and User scope powershell.config.json
147+
### System and User powershell.config.json configuration files
148148

149149
Enabling optional features automatically in future PowerShell sessions requires creating or updating one of two `powershell.config.json` configuration files that are read on startup of a new PowerShell session:
150150

@@ -172,23 +172,23 @@ This parameter set would enable, or disable if `-Disabled` is used, optional fea
172172
### New command: Get-OptionalFeatureConfiguration
173173

174174
```none
175-
Get-OptionalFeatureConfiguration [[-Name] <string[]>] [-UserScope { CurrentUser | AllUsers | Any }] [<CommonParameters>]
175+
Get-OptionalFeatureConfiguration [[-Name] <string[]>] [-For { CurrentUser | AllUsers }] [<CommonParameters>]
176176
```
177177

178178
This command would return the current configuration of optional features that are available in PowerShell, read from the configuration files.
179179

180-
The properties on the `S.M.A.OptionalFeatureConfiguration` object would be `Name`, `Session`, `NewManifest`, and `Scope`, defined as follows:
180+
The properties on the `S.M.A.OptionalFeatureConfiguration` object would be `Name`, `Session`, `NewManifest`, and `For`, defined as follows:
181181

182182
|Property Name|Description|
183183
|--|--|
184184
|`Name`|A string value that identifies the optional feature name|
185185
|`Session`|A boolean value that identifies whether the optional feature is enabled or disabled in the current and new PowerShell sessions|
186186
|`NewManifest`|A boolean value that identifies whether the optional feature is enabled or disabled in manifests created by new module manifests in the current and new PowerShell sessions|
187-
|`Scope`|An enumeration identifying whether the optional feature configuration was set up for the `CurrentUser` or `AllUsers`|
187+
|`For`|An enumeration flag identifying whether the optional feature configuration was set up for the `CurrentUser` or `AllUsers`|
188188

189-
The default output format is of type table with the properties `Name`, `Session`, and `NewManifest` with the results grouped by `Scope`.
189+
The default output format is of type table with the properties `Name`, `Session`, and `NewManifest` with the results grouped by `For`.
190190

191-
When this command is invoked with the `-UserScope` parameter, the results are automatically filtered for that scope. The default value for `-UserScope` is `Any`, showing configuration values from both configuration files.
191+
When this command is invoked with the `-For` parameter, the results are automatically filtered for that configuration file. The default value for `-For` is both flags, showing configuration values from both configuration files.
192192

193193
### New command: Get-OptionalFeature
194194

@@ -211,16 +211,16 @@ The default output format would be of type table with the properties `Name`, `So
211211
### Enabling and disabling optional features in current and future PowerShell sessions
212212

213213
```none
214-
Enable-OptionalFeature [-Name] <string[]> [-NewModuleManifests] [-UserScope { CurrentUser | AllUsers }] [-WhatIf] [-Confirm] [<CommonParameters>]
214+
Enable-OptionalFeature [-Name] <string[]> [-For { CurrentUser | AllUsers }] [-InNewModuleManifests] [-WhatIf] [-Confirm] [<CommonParameters>]
215215
216-
Disable-OptionalFeature [-Name] <string[]> [-NewModuleManifests] [-UserScope { CurrentUser | AllUsers }] [-WhatIf] [-Confirm] [<CommonParameters>]
216+
Disable-OptionalFeature [-Name] <string[]> [-For { CurrentUser | AllUsers }] [-InNewModuleManifests] [-WhatIf] [-Confirm] [<CommonParameters>]
217217
```
218218

219219
It is important to note up front that there are three default states for an optional feature: enabled by default, implicitly disabled by default, and explicitly disabled by default. The only time an optional feature needs to be explicitly disabled by default is if it is enabled by default in the AllUsers configuration file and a specific user wants to disable it for their sessions. This impacts how `Disable-OptionalFeature` works.
220220

221-
The `Enable-OptionalFeature` command will enable an optional feature in current and future PowerShell sessions either globally (if the `-NewModuleManifests` switch is not used) or only in manifests created by `New-ModuleManifest`.
221+
The `Enable-OptionalFeature` command will enable an optional feature in current and future PowerShell sessions either globally (if the `-InNewModuleManifests` switch is not used) or only in manifests created by `New-ModuleManifest`.
222222

223-
The `Disable-OptionalFeature` command will disable an optional feature in current and future PowerShell sessions either globally (if the `-NewModuleManifests` switch is not used) or only in manifests created by `New-ModuleManifest`. If the `AllUsers` scope is used and the optional feature is completely disabled in that scope as a result of this command, the entry is removed from the configuration file. If the `AllUsers` scope is used and there is no entry in the system (all users) configuration file, nothing happens. If the `CurrentUser` scope is used there is no entry in the system (all users) or current user configuration files, nothing happens. If the `CurrentUser` scope is used and the optional feature is enabled in the `AllUsers` configuration file, users will be informed that this feature is enabled for all users and asked to confirm that they want to explicitly disable this feature for the current user in the current and future PowerShell sessions. They can always re-enable it later.
223+
The `Disable-OptionalFeature` command will disable an optional feature in current and future PowerShell sessions either globally (if the `-InNewModuleManifests` switch is not used) or only in manifests created by `New-ModuleManifest`. If the feature is being disabled for `AllUsers` and the optional feature is completely disabled in that configuration file as a result of this command, the entry is removed from the configuration file. If the feature is being disabled for `AllUsers` and there is no entry in the system (all users) configuration file, nothing happens. If the feature is being disabled for the `CurrentUser` there is no entry in the system (all users) or current user configuration files, nothing happens. If the feature is being disabled for the `CurrentUser` and the optional feature is enabled in the `AllUsers` configuration file, users will be informed that this feature is enabled for all users and asked to confirm that they want to explicitly disable this feature for the current user in the current and future PowerShell sessions. They can always re-enable it later.
224224

225225
### New command: Use-OptionalFeature
226226

@@ -238,4 +238,4 @@ Optional features can be enabled or disabled in a session, module, script, or sc
238238

239239
### Extend experimental features to support the enhancements defined in this RFC
240240

241-
At a glance, experimental features and optional features are very similar to one another, so it was proposed that it may make sense to have them both use the same functionality when it comes to enabling/disabling them in scripts and modules; however, experimental features have a completely different intent (to try out new functionality in a PowerShell session), are only for future PowerShell sessions, and they only have a single on/off state. On the other hand, optional features are for the current and future PowerShell sessions, and may be enabled or disabled in various scopes within those sessions. For that reason, this approach doesn't seem like a viable solution. If we want to change that, perhaps someone should file an RFC against experimental features to make that change.
241+
At a glance, experimental features and optional features are very similar to one another, so it was proposed that it may make sense to have them both use the same functionality when it comes to enabling/disabling them in scripts and modules; however, experimental features have a completely different intent (to try out new functionality in a PowerShell session), are only for future PowerShell sessions, and they only have a single on/off state. On the other hand, optional features are for the current and future PowerShell sessions, for the current user or all users, and may be enabled or disabled in various scopes within those sessions. For that reason, this approach doesn't seem like a viable solution. If we want to change that, perhaps someone should file an RFC against experimental features to make that change.

0 commit comments

Comments
 (0)