Compare commits
3 Commits
68b21da5b9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| fc57d48814 | |||
| 5ec851fe11 | |||
| d219cd1479 |
10
alias.ps1
10
alias.ps1
@@ -1,5 +1,5 @@
|
|||||||
# Remove these aliases to PowerShell builtins which clobber the actaul exes.
|
# Remove builtin aliases
|
||||||
Remove-Item alias:curl
|
Remove-Item Alias:curl
|
||||||
Remove-Item alias:wget
|
Remove-Item Alias:wget
|
||||||
Remove-Item alias:cd
|
Remove-Item Alias:cd
|
||||||
# TODO: Remove default abbriviation aliases
|
Remove-Item Alias:rm
|
||||||
|
|||||||
33
utils.ps1
33
utils.ps1
@@ -13,4 +13,35 @@ function cd {
|
|||||||
Set-Location -Path $Path
|
Set-Location -Path $Path
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: Define rm to work with -rf and multiple entries
|
# Define rm to work like Unix/Linux
|
||||||
|
# * Support -r and -f flags also -rf or -fr
|
||||||
|
# * Support specifying multiple paths to remove
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Define touch to create a new empty text file
|
||||||
|
function touch {
|
||||||
|
Param (
|
||||||
|
[string]$Path
|
||||||
|
)
|
||||||
|
New-Item -Type File $Path
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user