Merge branch 'master' of github.com:fleschutz/PowerShell

This commit is contained in:
Markus Fleschutz 2023-10-06 10:17:48 +02:00
commit eef59091ed
2 changed files with 66 additions and 57 deletions

View File

@ -262,38 +262,38 @@ open-videos-folder.ps1, ,Opens the user's videos folder,
open-windows-terminal.ps1, ,Launches Windows Terminal,
open-wikipedia.ps1, ,Opens Wikipedia's website,
open-youtube.ps1, ,Opens YouTube.com,
pick-commit.ps1, ,Cherry-picks a Git commit into multiple branches,
pick-commit.ps1,git,Cherry-picks a Git commit into multiple branches,
ping-weather.ps1, ,Ping the currrent weather conditions,
play-bee-sound.ps1, ,"Plays a bee sound",
play-beep-sound.ps1, ,"Plays a short beep sound",
play-cat-sound.ps1, ,"Plays a cat sound",
play-cow-sound.ps1, ,"Plays a cow sound",
play-dog-sound.ps1, ,"Plays a dog sound",
play-donkey-sound.ps1, ,"Plays a donkey sound",
play-elephant-sound.ps1, ,"Plays an elephant sound",
play-elk-sound.ps1, ,"Plays an elk sound",
play-files.ps1, ,"Plays audio files (MP3 and WAV)",
play-frog-sound.ps1, ,"Plays a frog sound",
play-goat-sound.ps1, ,"Plays a goat sound",
play-gorilla-sound.ps1, ,"Plays a gorilla sound",
play-happy-birthday.ps1, ,"Plays the Happy Birthday song",
play-horse-sound.ps1, ,"Plays a horse sound",
play-imperial-march.ps1, ,"Plays the Imperial March (Star Wars)",
play-jingle-bells.ps1, ,"Plays Jingle Bells",
play-lion-sound.ps1, ,"Plays a lion sound",
play-m3u.ps1, ,"Plays a playlist (.M3U format)",
play-mission-impossible.ps1, ,"Plays the Mission Impossible theme",
play-mp3.ps1, ,"Plays a MP3 sound file",
play-parrot-sound.ps1, ,"Plays a parrot sound",
play-pig-sound.ps1, ,"Plays a pig sound",
play-pong.ps1, ,"play-pong.ps1",
play-rattlesnake-sound.ps1, ,"Plays a rattlesnake sound",
play-rick.ps1, ,"Plays Rick Astley",
play-snake.ps1, ,"Play the Snake game",
play-super-mario.ps1, ,"Plays the Super Mario intro",
play-tetris-melody.ps1, ,"Plays the Tetris melody",
play-vulture-sound.ps1, ,"Plays a vulture sound",
play-wolf-sound.ps1, ,"Plays a wolf sound",
play-bee-sound.ps1,audio,"Plays a bee sound",
play-beep-sound.ps1,audio,"Plays a short beep sound",
play-cat-sound.ps1,audio,"Plays a cat sound",
play-cow-sound.ps1,audio,"Plays a cow sound",
play-dog-sound.ps1,audio,"Plays a dog sound",
play-donkey-sound.ps1,audio,"Plays a donkey sound",
play-elephant-sound.ps1,audio,"Plays an elephant sound",
play-elk-sound.ps1,audio,"Plays an elk sound",
play-files.ps1,audio,"Plays audio files (MP3 and WAV)",
play-frog-sound.ps1,audio,"Plays a frog sound",
play-goat-sound.ps1,audio,"Plays a goat sound",
play-gorilla-sound.ps1,audio,"Plays a gorilla sound",
play-happy-birthday.ps1,audio,"Plays the Happy Birthday song",
play-horse-sound.ps1,audio,"Plays a horse sound",
play-imperial-march.ps1,audio,"Plays the Imperial March (Star Wars)",
play-jingle-bells.ps1,audio,"Plays Jingle Bells",
play-lion-sound.ps1,audio,"Plays a lion sound",
play-m3u.ps1,audio,"Plays a playlist (.M3U format)",
play-mission-impossible.ps1,audio,"Plays the Mission Impossible theme",
play-mp3.ps1,audio,"Plays a MP3 sound file",
play-parrot-sound.ps1,audio,"Plays a parrot sound",
play-pig-sound.ps1,audio,"Plays a pig sound",
play-pong.ps1,game,"play-pong.ps1",
play-rattlesnake-sound.ps1,audio,"Plays a rattlesnake sound",
play-rick.ps1,fun,"Plays Rick Astley",
play-snake.ps1,game,"Play the Snake game",
play-super-mario.ps1,audio,"Plays the Super Mario intro",
play-tetris-melody.ps1,audio,"Plays the Tetris melody",
play-vulture-sound.ps1,audio,"Plays a vulture sound",
play-wolf-sound.ps1,audio,"Plays a wolf sound",
poweroff.ps1, ,Halts the local computer (needs admin rights),
publish-to-ipfs.ps1, ,Publishes the given files or directory to IPFS,
pull-repo.ps1,git,Pulls updates for the current/given Git repository (including submodules),

1 SCRIPT CATEGORY DESCRIPTION
262 open-windows-terminal.ps1 Launches Windows Terminal
263 open-wikipedia.ps1 Opens Wikipedia's website
264 open-youtube.ps1 Opens YouTube.com
265 pick-commit.ps1 git Cherry-picks a Git commit into multiple branches
266 ping-weather.ps1 Ping the currrent weather conditions
267 play-bee-sound.ps1 audio Plays a bee sound
268 play-beep-sound.ps1 audio Plays a short beep sound
269 play-cat-sound.ps1 audio Plays a cat sound
270 play-cow-sound.ps1 audio Plays a cow sound
271 play-dog-sound.ps1 audio Plays a dog sound
272 play-donkey-sound.ps1 audio Plays a donkey sound
273 play-elephant-sound.ps1 audio Plays an elephant sound
274 play-elk-sound.ps1 audio Plays an elk sound
275 play-files.ps1 audio Plays audio files (MP3 and WAV)
276 play-frog-sound.ps1 audio Plays a frog sound
277 play-goat-sound.ps1 audio Plays a goat sound
278 play-gorilla-sound.ps1 audio Plays a gorilla sound
279 play-happy-birthday.ps1 audio Plays the Happy Birthday song
280 play-horse-sound.ps1 audio Plays a horse sound
281 play-imperial-march.ps1 audio Plays the Imperial March (Star Wars)
282 play-jingle-bells.ps1 audio Plays Jingle Bells
283 play-lion-sound.ps1 audio Plays a lion sound
284 play-m3u.ps1 audio Plays a playlist (.M3U format)
285 play-mission-impossible.ps1 audio Plays the Mission Impossible theme
286 play-mp3.ps1 audio Plays a MP3 sound file
287 play-parrot-sound.ps1 audio Plays a parrot sound
288 play-pig-sound.ps1 audio Plays a pig sound
289 play-pong.ps1 game play-pong.ps1
290 play-rattlesnake-sound.ps1 audio Plays a rattlesnake sound
291 play-rick.ps1 fun Plays Rick Astley
292 play-snake.ps1 game Play the Snake game
293 play-super-mario.ps1 audio Plays the Super Mario intro
294 play-tetris-melody.ps1 audio Plays the Tetris melody
295 play-vulture-sound.ps1 audio Plays a vulture sound
296 play-wolf-sound.ps1 audio Plays a wolf sound
297 poweroff.ps1 Halts the local computer (needs admin rights)
298 publish-to-ipfs.ps1 Publishes the given files or directory to IPFS
299 pull-repo.ps1 git Pulls updates for the current/given Git repository (including submodules)

View File

@ -23,49 +23,58 @@ function GetTempDir {
return "C:\Temp"
}
function AddLine { param([string]$FolderName, [string]$FolderPath)
if (Test-Path "$FolderPath" -pathType container) {
New-Object PSObject -property @{ 'Folder Name' = "$FolderName"; 'Folder Path' = "📂$FolderPath" }
function TryFolder([string]$name, [string]$path) {
if (Test-Path "$path" -pathType container) {
New-Object PSObject -property @{ 'Folder Name' = "$name"; 'Folder Path' = "📂$path" }
}
}
function ListSpecialFolders {
if ($IsLinux) {
AddLine "Desktop" "$HOME/Desktop/"
AddLine "Documents" "$HOME/Documents/"
AddLine "Downloads" "$HOME/Downloads/"
AddLine "Dropbox" "$HOME/Dropbox/"
AddLine "Home" "$HOME/"
AddLine "Music" "$HOME/Music/"
AddLine "Pictures" "$HOME/Pictures/"
AddLine "Repositories" "$HOME/Repos/"
AddLine "Repositories" "$HOME/Repositories/"
AddLine "Screenshots" "$HOME/Pictures/Screenshots/"
AddLine "Snap" "$HOME/snap/"
AddLine "SSH" "$HOME/.ssh/"
AddLine "Trash" "$HOME/.local/share/Trash/"
AddLine "Templates" "$Home/Templates/"
AddLine "Temporary" "$(GetTempDir)"
TryFolder "Boot files" "/boot"
TryFolder "Config files" "/etc"
TryFolder "Desktop" "$HOME/Desktop"
TryFolder "Device files" "/dev"
TryFolder "Documents" "$HOME/Documents"
TryFolder "Downloads" "$HOME/Downloads"
TryFolder "Dropbox" "$HOME/Dropbox"
TryFolder "Home" "$HOME"
TryFolder "Mount points" "/mnt"
TryFolder "Music" "$HOME/Music"
TryFolder "Optional packages" "/opt"
TryFolder "Pictures" "$HOME/Pictures"
TryFolder "Recovered files" "/lost+found"
TryFolder "Removable media" "/media"
TryFolder "Repositories" "$HOME/Repos"
TryFolder "Repositories" "$HOME/Repositories"
TryFolder "Root" "/"
TryFolder "Screenshots" "$HOME/Pictures/Screenshots"
TryFolder "Snap" "$HOME/snap"
TryFolder "SSH" "$HOME/.ssh"
TryFolder "System binaries" "/sbin"
TryFolder "Trash" "$HOME/.local/share/Trash"
TryFolder "Templates" "$Home/Templates"
TryFolder "Temporary" "$(GetTempDir)"
$Path = Resolve-Path "$HOME/.."
AddLine "Users" "$Path/"
AddLine "Videos" "$HOME/Videos/"
TryFolder "Users" "$Path"
TryFolder "Videos" "$HOME/Videos"
} else {
$FolderNames = [System.Enum]::GetNames('System.Environment+SpecialFolder')
$FolderNames | Sort-Object | ForEach-Object {
if ($Path = [System.Environment]::GetFolderPath($_)) {
AddLine "$_" "$Path"
TryFolder "$_" "$Path"
}
}
AddLine "Repositories" "$HOME\source\repos"
AddLine "SSH" "$HOME\.ssh"
AddLine "Temporary" "$(GetTempDir)"
TryFolder "Repositories" "$HOME\source\repos"
TryFolder "SSH" "$HOME\.ssh"
TryFolder "Temporary" "$(GetTempDir)"
$Path = Resolve-Path "$HOME/.."
AddLine "Users" "$Path"
TryFolder "Users" "$Path"
}
}
try {
ListSpecialFolders | Format-Table -property @{e='Folder Name';width=18},'Folder Path'
ListSpecialFolders | Format-Table -property @{e='Folder Name';width=19},'Folder Path'
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"