Compare commits

..

1 Commits

Author SHA1 Message Date
68b21da5b9 Replace default cd alias with cd function
Define cd to work more like Unix/Linux:

* No path argument changes to the users home directory
* Passing "-" for the path argument changes to the previous directory
2024-12-13 20:52:18 +00:00
2 changed files with 6 additions and 34 deletions

View File

@ -1,5 +1,5 @@
# Remove builtin aliases
Remove-Item Alias:curl
Remove-Item Alias:wget
Remove-Item Alias:cd
Remove-Item Alias:rm
# Remove these aliases to PowerShell builtins which clobber the actaul exes.
Remove-Item alias:curl
Remove-Item alias:wget
Remove-Item alias:cd
# TODO: Remove default abbriviation aliases

View File

@ -13,32 +13,4 @@ function cd {
Set-Location -Path $Path
}
function rm {
Param (
[Parameter(
Mandatory=$true,
ValueFromRemainingArguments=$true
)][string[]]$Paths,
[switch]$F, [switch]$Force,
[switch]$R, [switch]$Recurse,
[switch]$RF, [switch]$FR
)
$Command = "Remove-Item"
if ($F -or $Force -or $RF -or $FR) {
$Command = "$Command -Force"
}
if ($R -or $Recurse -or $RF -or $FR) {
$Command = "$Command -Recurse"
}
foreach ($Path in $Paths) {
Invoke-Expression -Command "$Command $Path"
}
}
# Add new aliases
function touch {
Param (
[string]$Path
)
New-Item -Type File $Path
}
# TODO: Define rm to work with -rf and multiple entries