Delete outdated files

This commit is contained in:
2026-03-24 13:03:51 -03:00
parent 739fd217f6
commit c6345d6b6c
5 changed files with 0 additions and 2705 deletions

View File

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

View File

@@ -1,14 +0,0 @@
# Scoop search
Invoke-Expression (&scoop-search --hook)
# Scoop completion
Import-Module "$($(Get-Item $(Get-Command scoop.ps1).Path).Directory.Parent.FullName)\modules\scoop-completion"
# Chezmoi
if (Get-Command chezmoi -ErrorAction SilentlyContinue) { chezmoi completion powershell | Out-String | Invoke-Expression }
# Github CLI
Invoke-Expression -Command $(gh completion -s powershell | Out-String)
# gsudo
Import-Module gsudoModule
# zoxide
Invoke-Expression (& { (zoxide init powershell | Out-String) })
# packwiz
packwiz completion powershell | Out-String | Invoke-Expression

View File

@@ -1,28 +0,0 @@
function sortScoopOutput($scoop) {
$ht = ConvertFrom-Json -AsHashtable -InputObject $scoop
$od = [ordered]@{}
# Structure of json is object with a key name and the value as an array of objects, which each have 4 key value pairs
# Sort the keys and the array of objects, as well the key value pairs in the objects
foreach ($key in $ht.Keys | Sort-Object) {
$od[$key] = @()
foreach ($app in $ht[$key] | Sort-Object) {
$app = $app | Sort-Object
$od[$key] += [ordered]@{}
foreach ($k in $app.Keys | Sort-Object) {
$od[$key][-1][$k] = $app[$k]
}
}
# Sort the array by the name key
# NOTE: This property is hard coded, and could be changed if scoop changes the json structure
$od[$key] = $od[$key] | Sort-Object -Property name
}
$json = ConvertTo-Json -InputObject $od
$json_string = $json -join "`n"
return $json_string
}
# Scoop installed apps
# sortScoopOutput($(scoop export)) | Out-File "~\scoop\apps.json"
scoop export | Out-File "~\scoop\apps.json"
# Pipx installed apps
pipx list --json | Out-File "~\.pipx.json"

View File

@@ -1,31 +0,0 @@
function differences($required, $installed) {
# Args in json format
# Only compare the names of the software
# Format is a json array of objects with a name property
$required_names = $required | ForEach-Object { $_.name }
$installed_names = $installed | ForEach-Object { $_.name }
$diff = Compare-Object $required_names $installed_names
return $diff
}
if (-not (Test-Path "~\scoop\apps.json")) {
Write-Host "Scoop is installed but the apps.json file is missing"
}
scoop export | Out-File "~\scoop\apps.json"
# Diff the installed software with the required software, if there are differences, install the required software
$required = Get-Content "~\scoop\apps.json" | ConvertFrom-Json
$installed = scoop export | ConvertFrom-Json
$differences = differences $required.apps $installed.apps
if ($differences) {
Write-Host "The following software not synced:"
$differences | ForEach-Object { Write-Host $_.InputObject }
$install = Read-Host "Would you like to install the missing software? (y/n)"
if ($install -eq "y") {
# Install the missing software
scoop import "~\scoop\apps.json"
}
else {
Write-Host "The required software is not installed"
}
}