Add update alias

This commit is contained in:
Isaac Shoebottom 2024-12-18 01:42:46 -04:00
parent 87879c7e0f
commit 7e85d5e6a5

View File

@ -1,63 +1,68 @@
# Unix like pwd # Unix like pwd
if (Test-Path alias:pwd) { if (Test-Path alias:pwd) {
Remove-Alias -Name pwd Remove-Alias -Name pwd
} }
Function pwd { (Get-Location).Path } Function pwd { (Get-Location).Path }
# Change to dotfiles directory # Change to dotfiles directory
if (Test-Path alias:dotfolder) { if (Test-Path alias:dotfolder) {
Remove-Alias -Name dotfolder Remove-Alias -Name dotfolder
} }
Function dotfolder { Set-Location ~/.local/share/chezmoi } Function dotfolder { Set-Location ~/.local/share/chezmoi }
if (Test-Path alias:dotcommit) { if (Test-Path alias:dotcommit) {
Remove-Alias -Name dotcommit Remove-Alias -Name dotcommit
} }
Function dotcommit { Function dotcommit {
# Export installed apps to file # Export installed apps to file
. ~/Documents/PowerShell/installed-apps.ps1 . ~/Documents/PowerShell/installed-apps.ps1
# If no arguments are passed, use the default message # If no arguments are passed, use the default message
if ($args.Length -eq 0) { if ($args.Length -eq 0) {
$message = "Update dotfiles" $message = "Update dotfiles"
} }
else { else {
$message = $args -join " " $message = $args -join " "
} }
chezmoi re-add chezmoi re-add
chezmoi diff chezmoi diff
chezmoi git -- commit -a -m $message chezmoi git -- commit -a -m $message
chezmoi git -- push chezmoi git -- push
chezmoi apply chezmoi apply
} }
# Replace cat with bat # Replace cat with bat
if (Test-Path alias:cat) { if (Test-Path alias:cat) {
Remove-Alias -Name cat Remove-Alias -Name cat
} }
Set-Alias -Name cat -Value bat Set-Alias -Name cat -Value bat
# Replace ls with exa # Replace ls with exa
if (Test-Path alias:ls) { if (Test-Path alias:ls) {
Remove-Alias -Name ls Remove-Alias -Name ls
} }
Set-Alias -Name ls -Value exa Set-Alias -Name ls -Value exa
# Replace cd with zoxide # Replace cd with zoxide
if (Test-Path alias:cd) { if (Test-Path alias:cd) {
Remove-Alias -Name cd Remove-Alias -Name cd
} }
Set-Alias -Name cd -Value z Set-Alias -Name cd -Value z
# Replace grep with ugrep # Replace grep with ugrep
if (Test-Path alias:grep) { if (Test-Path alias:grep) {
Remove-Alias -Name grep Remove-Alias -Name grep
} }
Set-Alias -Name grep -Value ugrep Set-Alias -Name grep -Value ugrep
# Add alias for recycle-bin # Add alias for recycle-bin
if (Test-Path alias:rb) { if (Test-Path alias:rb) {
Remove-Alias -Name rb Remove-Alias -Name rb
} }
Set-Alias -Name rb -Value recycle-bin Set-Alias -Name rb -Value recycle-bin
# Add shorthand alias for scoop update and cleanup
Function update {
sudo scoop update * && sudo scoop cleanup * && scoop cache rm *
}