Compare commits
2 Commits
fc57d48814
...
125a509240
Author | SHA1 | Date | |
---|---|---|---|
125a509240 | |||
b49371eaa3 |
@ -2,3 +2,4 @@
|
|||||||
Remove-Item Alias:curl
|
Remove-Item Alias:curl
|
||||||
Remove-Item Alias:wget
|
Remove-Item Alias:wget
|
||||||
Remove-Item Alias:cd
|
Remove-Item Alias:cd
|
||||||
|
Remove-Item Alias:rm
|
||||||
|
30
utils.ps1
30
utils.ps1
@ -13,4 +13,32 @@ function cd {
|
|||||||
Set-Location -Path $Path
|
Set-Location -Path $Path
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: Define rm to work with -rf and multiple entries
|
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
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user