Compare commits
1 Commits
main
...
68b21da5b9
| Author | SHA1 | Date | |
|---|---|---|---|
| 68b21da5b9 |
10
alias.ps1
10
alias.ps1
@@ -1,5 +1,5 @@
|
|||||||
# Remove builtin aliases
|
# Remove these aliases to PowerShell builtins which clobber the actaul exes.
|
||||||
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
|
# TODO: Remove default abbriviation aliases
|
||||||
|
|||||||
33
utils.ps1
33
utils.ps1
@@ -13,35 +13,4 @@ function cd {
|
|||||||
Set-Location -Path $Path
|
Set-Location -Path $Path
|
||||||
}
|
}
|
||||||
|
|
||||||
# Define rm to work like Unix/Linux
|
# TODO: Define rm to work with -rf and multiple entries
|
||||||
# * 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