Compare commits
3 Commits
68b21da5b9
...
125a509240
Author | SHA1 | Date | |
---|---|---|---|
125a509240 | |||
b49371eaa3 | |||
d219cd1479 |
@ -1,4 +1,5 @@
|
||||
# Remove these aliases to PowerShell builtins which clobber the actaul exes.
|
||||
Remove-Item alias:curl
|
||||
Remove-Item alias:wget
|
||||
# TODO: Remove default abbriviation aliases
|
||||
# Remove builtin aliases
|
||||
Remove-Item Alias:curl
|
||||
Remove-Item Alias:wget
|
||||
Remove-Item Alias:cd
|
||||
Remove-Item Alias:rm
|
||||
|
@ -11,4 +11,5 @@ $OutputEncoding = New-Object -typename System.Text.UTF8Encoding
|
||||
. $PSScriptRoot\alias.ps1
|
||||
. $PSScriptRoot\utils.ps1
|
||||
. $PSScriptRoot\layout.ps1
|
||||
# TODO: $PSScriptRoot\build.ps1
|
||||
# TODO: . $PSScriptRoot\build.ps1
|
||||
# TODO: . $PSScriptRoot\autoenv.ps1
|
||||
|
46
utils.ps1
46
utils.ps1
@ -1,2 +1,44 @@
|
||||
# TODO: Define cd to work with zero args for home and - for last directory
|
||||
# TODO: Define rm to work with -rf and multiple entries
|
||||
# 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
|
||||
$Global:cdPreviousPath = Get-Location
|
||||
function cd {
|
||||
Param ([string]$Path)
|
||||
if ($Path -eq "") {
|
||||
$Path = "~"
|
||||
} elseif ($Path -eq "-") {
|
||||
$Path = $cdPreviousPath
|
||||
}
|
||||
$Global:cdPreviousPath = Get-Location
|
||||
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user