mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add Enable-ExperimentalFeature and Disable-ExperimentalFeature cmdlets (#8318)
[breaking change] Major changes are as follows: - Add `Enable-ExperimentalFeature` and `Disable-ExperimentalFeature` cmdlets. - Remove `-ListAvailable` from `Get-ExperimentalFeature`. - Add `ArgumentCompleter` for `Get-ExperimentalFeature` cmdlet. - Refactor some existing Experimental Feature tests. - Make `ConfigScope` public and renamed `SystemWide` to `AllUsers`. Also update experimental feature code to prefer the current user config over the all user config.
This commit is contained in:
@@ -1286,7 +1286,7 @@ namespace System.Management.Automation
|
||||
// If the Windows PowerShell Module path is already present, insert the system module path
|
||||
// ($PSHOME/Modules) before it.
|
||||
insertIndex = PathContainsSubstring(currentProcessModulePath, windowsPowerShellModulePath);
|
||||
#endif
|
||||
#endif
|
||||
currentProcessModulePath = AddToPath(currentProcessModulePath, systemModulePathToUse, insertIndex);
|
||||
}
|
||||
|
||||
@@ -1295,7 +1295,7 @@ namespace System.Management.Automation
|
||||
|
||||
// index of $PSHome\Modules in currentProcessModulePath
|
||||
int indexOfPSHomeModulePath = PathContainsSubstring(currentProcessModulePath, psHomeModulePath);
|
||||
|
||||
|
||||
// if $PSHome\Modules not found (psHomePosition == -1) - append <Program Files> location to the end;
|
||||
// if $PSHome\Modules IS found (psHomePosition >= 0) - insert <Program Files> location before $PSHome\Modules
|
||||
currentProcessModulePath = AddToPath(currentProcessModulePath, sharedModulePath, indexOfPSHomeModulePath);
|
||||
@@ -1322,10 +1322,10 @@ namespace System.Management.Automation
|
||||
private static string SetModulePath()
|
||||
{
|
||||
string currentModulePath = GetExpandedEnvironmentVariable(Constants.PSModulePathEnvVar, EnvironmentVariableTarget.Process);
|
||||
string systemWideModulePath = PowerShellConfig.Instance.GetModulePath(ConfigScope.SystemWide);
|
||||
string allUsersModulePath = PowerShellConfig.Instance.GetModulePath(ConfigScope.AllUsers);
|
||||
string personalModulePath = PowerShellConfig.Instance.GetModulePath(ConfigScope.CurrentUser);
|
||||
|
||||
string newModulePathString = GetModulePath(currentModulePath, systemWideModulePath, personalModulePath);
|
||||
string newModulePathString = GetModulePath(currentModulePath, allUsersModulePath, personalModulePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(newModulePathString))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user