|
| 1 | +--- |
| 2 | +RFC: RFC0000 |
| 3 | +Author: Steve Lee |
| 4 | +Status: Draft |
| 5 | +SupercededBy: N/A |
| 6 | +Version: 1.0 |
| 7 | +Area: Microsoft.PowerShell.Core |
| 8 | +Comments Due: 12/1/2018 |
| 9 | +Plan to implement: Yes |
| 10 | +--- |
| 11 | + |
| 12 | +# Experimental Feature User Experience |
| 13 | + |
| 14 | +[Experimental Feature Flags](https://github.com/PowerShell/PowerShell-RFC/blob/master/5-Final/RFC0029-Support-Experimental-Features.md) enable developers to expose experimental features to users to gather feedback before finalizing design. |
| 15 | +That feature was focused on the developer and did not make it easy for users to discover and enable experimental features. |
| 16 | +This RFC addresses the user experience. |
| 17 | + |
| 18 | +## Motivation |
| 19 | + |
| 20 | + As a PowerShell user, |
| 21 | + I can discover and enable experimental features, |
| 22 | + so that try new capabilities safely and provide feedback. |
| 23 | + |
| 24 | +## Specification |
| 25 | + |
| 26 | +### Get-ExperimentalFeature *Breaking Change* |
| 27 | + |
| 28 | +Currently, `Get-ExperimentalFeature` requires the `-ListAvailable` switch to enumerate available experimental features. |
| 29 | +This was modeled after `Get-Module -ListAvailable`. |
| 30 | +Without the switch, `Get-ExperimentalFeature` only shows the enabled experimental features, which by default is none. |
| 31 | +Most users will try this cmdlet without the switch and assume there are no experimental features to try. |
| 32 | + |
| 33 | +Since there are likely not many experimental features available at any point in time and less enabled, |
| 34 | +it would make sense to remove the `-ListAvailable` switch and simply display all experimental features. |
| 35 | +The current output already has a column indicating if the experimental feature is enabled allowing for easy filtering. |
| 36 | + |
| 37 | +### User scope powershell.config.json |
| 38 | + |
| 39 | +Enabling experimental features require creating or updating a `powershell.config.json` file in `$PSHOME` which is read at startup. |
| 40 | +In general, we should allow use of PowerShell Core without the need to be root or elevated. |
| 41 | + |
| 42 | +The change proposed is to support automatic loading of `powershell.config.json` from `$HOME\Documents\PowerShell\powershell.config.json` on Windows |
| 43 | +and from `$HOME/.config/powershell/powershell.config.json` on Linux and macOS. |
| 44 | + |
| 45 | +If an admin has provided a `powershell.config.json` file in `$PSHOME` and the user has one in their scope, |
| 46 | +then on `pwsh` startup, it will read the one in `$PSHOME` and clobber the properties that exist from the user configuration. |
| 47 | + |
| 48 | +Since this is configuration and not policy, the user configuration overrides the system configuration default settings. |
| 49 | +The user can always prevent inheriting configuration from the system by explicitly starting `pwsh` with the |
| 50 | +`-SettingsFile` parameter which will only read configuration from that specified file. |
| 51 | + |
| 52 | +### Enable and Disable cmdlets |
| 53 | + |
| 54 | +```none |
| 55 | +Enable-ExperimentalFeature [[-Name] <string[]>] [-Scope <CurrentUser|System>] [<CommonParameters>] |
| 56 | +
|
| 57 | +Disable-ExperimentalFeature [[-Name] <string[]>] [-Scope <CurrentUser|System>] [<CommonParameters>] |
| 58 | +``` |
| 59 | + |
| 60 | +These cmdlets allow users to selectively enable and disable experimental features. |
| 61 | + |
| 62 | +The `-Name` parameter shall accept `ValueFromPipelineByPropertyName` and is the name of the experimental feature. |
| 63 | + |
| 64 | +The `-Scope` parameter is optional and defaults to `CurrentUser` and will create or update the |
| 65 | +`powershell.config.json` in `$HOME\Documents\PowerShell\powershell.config.json` on Windows |
| 66 | +and from `$HOME/.config/powershell/powershell.config.json` on Linux and macOS. |
| 67 | +If `-Scope` is `System`, it will create or update `$PSHOME\powershell.config.json`. |
| 68 | + |
| 69 | +Experimental features are read and enabled at PowerShell startup, so a warning message will be provided informing the user: |
| 70 | +> Experimental feature changes will only be applied after restarting PowerShell. |
| 71 | +
|
| 72 | +## Alternate Proposals and Considerations |
| 73 | + |
| 74 | +### Configuration file |
| 75 | + |
| 76 | +In the case where there is both a system and current user configuration, |
| 77 | +an alternate proposal is to not read the system configuration if the user configuration exists. |
| 78 | +However, in the future, there may be useful configuration settings that make sense to have |
| 79 | +as default values for a specific environment. |
| 80 | + |
| 81 | +### Enabled property |
| 82 | + |
| 83 | +Currently, an experimental feature has an `Enabled` property that is `true` or `false`. |
| 84 | +In addition to the warning message that a restart is required after changing experimental feature status, |
| 85 | +the `Enabled` property could be changed to an enum instead of a boolean: True, False, Pending. |
| 86 | +However, since experimental features is expected to be used by more advanced users, |
| 87 | +this seems unnecessary. |
0 commit comments