Add -l support for pwsh to match POSIX shell compatibility

This commit is contained in:
Steve Lee 2019-05-03 11:00:23 -07:00
parent 3bfca6d0fa
commit fb3a9098b5

View file

@ -173,28 +173,29 @@ namespace Microsoft.PowerShell
private const int MaxPipePathLengthMacOS = 104;
internal static string[] validParameters = {
"version",
"nologo",
"noexit",
#if STAMODE
"sta",
"mta",
#endif
"noprofile",
"noninteractive",
"inputformat",
"outputformat",
"windowstyle",
"encodedcommand",
"configurationname",
"file",
"executionpolicy",
"command",
"settingsfile",
"configurationname",
"custompipename",
"encodedcommand",
"executionpolicy",
"file",
"help",
"workingdirectory",
"inputformat",
"loadprofile",
"noexit",
"nologo",
"noninteractive",
"noprofile",
"outputformat",
"removeworkingdirectorytrailingcharacter",
"custompipename"
"settingsfile",
"version",
"windowstyle",
"workingdirectory"
};
internal CommandLineParameterParser(PSHostUserInterface hostUI, string bannerText, string helpText)
@ -742,6 +743,10 @@ namespace Microsoft.PowerShell
_noExit = true;
noexitSeen = true;
}
else if (MatchSwitch(switchKey, "loadprofile", "l"))
{
// do nothing as we load profile by default, but this is needed to be compatible with POSIX shell expectations
}
else if (MatchSwitch(switchKey, "noprofile", "nop"))
{
_skipUserInit = true;