Remove conflicting aliases for Linux and OS X
The aliases which conflict with Linux native commands were consolidated and removed with the pre-processor definition `LINUX`. Additionally, several "conflicts" are purposefully kept and likewise consolidated. They are kept because Bash itself stomps on the native commands with its own built-ins, and so we're adopting the same behavior. The `clear` and `more` aliases are edge cases where the functions they call are already fixed for Linux, and so we keep these too. Resolves #567.
This commit is contained in:
parent
d260131f4b
commit
7d9f439666
|
@ -5121,8 +5121,6 @@ end
|
|||
"Where-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("?",
|
||||
"Where-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("ac",
|
||||
"Add-Content", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("clc",
|
||||
"Clear-Content", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cli",
|
||||
|
@ -5131,26 +5129,18 @@ end
|
|||
"Clear-ItemProperty", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("clv",
|
||||
"Clear-Variable", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("compare",
|
||||
"Compare-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cpi",
|
||||
"Copy-Item", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cpp",
|
||||
"Copy-ItemProperty", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cvpa",
|
||||
"Convert-Path", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("dbp",
|
||||
"Disable-PSBreakpoint", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("diff",
|
||||
"Compare-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("ebp",
|
||||
"Enable-PSBreakpoint", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("epal",
|
||||
"Export-Alias", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("epcsv",
|
||||
"Export-Csv", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("fc",
|
||||
"Format-Custom", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("fl",
|
||||
"Format-List", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("ft",
|
||||
|
@ -5260,26 +5250,75 @@ end
|
|||
"Set-Item", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("sl",
|
||||
"Set-Location", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("sleep",
|
||||
"Start-Sleep", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("sort",
|
||||
"Sort-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("sp",
|
||||
"Set-ItemProperty", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("saps",
|
||||
"Start-Process", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("start",
|
||||
"Start-Process", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("spps",
|
||||
"Stop-Process", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("spsv",
|
||||
"Stop-Service", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("sv",
|
||||
"Set-Variable", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
// Porting note: #if !LINUX is used to disable alises for cmdlets which conflict with Linux / OS X
|
||||
#if !LINUX
|
||||
// ac is a native command on OS X
|
||||
new SessionStateAliasEntry("ac",
|
||||
"Add-Content", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("compare",
|
||||
"Compare-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cpp",
|
||||
"Copy-ItemProperty", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("diff",
|
||||
"Compare-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("sleep",
|
||||
"Start-Sleep", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("sort",
|
||||
"Sort-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("start",
|
||||
"Start-Process", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("tee",
|
||||
"Tee-Object", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("write",
|
||||
"Write-Output", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
// These were traqnsferred from the "transferred from the profile" section
|
||||
new SessionStateAliasEntry("cat",
|
||||
"Get-Content", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cp",
|
||||
"Copy-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("ls",
|
||||
"Get-ChildItem", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("man",
|
||||
"help", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("mount",
|
||||
"New-PSDrive", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("mv",
|
||||
"Move-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("ps",
|
||||
"Get-Process", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("rm",
|
||||
"Remove-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("rmdir",
|
||||
"Remove-Item", "", ScopedItemOptions.AllScope),
|
||||
#endif
|
||||
// Bash built-ins we purposefully keep even if they override native commands
|
||||
new SessionStateAliasEntry("cd",
|
||||
"Set-Location", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("dir",
|
||||
"Get-ChildItem", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("echo",
|
||||
"Write-Output", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("fc",
|
||||
"Format-Custom", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("kill",
|
||||
"Stop-Process", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("pwd",
|
||||
"Get-Location", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("type",
|
||||
"Get-Content", "", ScopedItemOptions.AllScope),
|
||||
// Native commands we keep because the functions act correctly on Linux
|
||||
new SessionStateAliasEntry("clear",
|
||||
"Clear-Host", "", ScopedItemOptions.AllScope),
|
||||
//#if !CORECLR is used to disable aliases for cmdlets which are not available on OneCore
|
||||
#if !CORECLR
|
||||
new SessionStateAliasEntry("asnp",
|
||||
|
@ -5316,46 +5355,18 @@ end
|
|||
"Out-Printer", "", ScopedItemOptions.AllScope),
|
||||
#endif
|
||||
// Aliases transferred from the profile
|
||||
new SessionStateAliasEntry("cat",
|
||||
"Get-Content", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cd",
|
||||
"Set-Location", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("clear",
|
||||
"Clear-Host", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cp",
|
||||
"Copy-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("h",
|
||||
"Get-History", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("history",
|
||||
"Get-History", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("kill",
|
||||
"Stop-Process", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("ls",
|
||||
"Get-ChildItem", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("man",
|
||||
"help", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("mount",
|
||||
"New-PSDrive", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("md",
|
||||
"mkdir", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("mv",
|
||||
"Move-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("popd",
|
||||
"Pop-Location", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("ps",
|
||||
"Get-Process", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("pushd",
|
||||
"Push-Location", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("pwd",
|
||||
"Get-Location", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("r",
|
||||
"Invoke-History", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("rm",
|
||||
"Remove-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("rmdir",
|
||||
"Remove-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("echo",
|
||||
"Write-Output", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("cls",
|
||||
"Clear-Host", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("chdir",
|
||||
|
@ -5364,8 +5375,6 @@ end
|
|||
"Copy-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("del",
|
||||
"Remove-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("dir",
|
||||
"Get-ChildItem", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("erase",
|
||||
"Remove-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("move",
|
||||
|
@ -5376,8 +5385,6 @@ end
|
|||
"Rename-Item", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("set",
|
||||
"Set-Variable", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("type",
|
||||
"Get-Content", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("icm",
|
||||
"Invoke-Command", "", ScopedItemOptions.AllScope),
|
||||
new SessionStateAliasEntry("clhy",
|
||||
|
@ -5460,9 +5467,13 @@ if($paths) {
|
|||
SessionStateFunctionEntry.GetDelayParsedFunctionEntry("prompt", DefaultPromptFunctionText),
|
||||
SessionStateFunctionEntry.GetDelayParsedFunctionEntry("TabExpansion2", TabExpansionFunctionText),
|
||||
SessionStateFunctionEntry.GetDelayParsedFunctionEntry("Clear-Host", GetClearHostFunctionText()),
|
||||
// Porting note: we keep more because the function acts correctly on Linux
|
||||
SessionStateFunctionEntry.GetDelayParsedFunctionEntry("more", DefaultMoreFunctionText),
|
||||
SessionStateFunctionEntry.GetDelayParsedFunctionEntry("help", GetHelpPagingFunctionText()),
|
||||
// Porting note: we remove mkdir on Linux because it is a conflict
|
||||
#if !LINUX
|
||||
SessionStateFunctionEntry.GetDelayParsedFunctionEntry("mkdir", GetMkdirFunctionText()),
|
||||
#endif
|
||||
SessionStateFunctionEntry.GetDelayParsedFunctionEntry("Get-Verb", GetGetVerbText()),
|
||||
SessionStateFunctionEntry.GetDelayParsedFunctionEntry("oss", GetOSTFunctionText()),
|
||||
|
||||
|
|
Loading…
Reference in a new issue