Updated list-cli-tools.ps1

This commit is contained in:
Markus Fleschutz 2024-11-24 10:18:16 +01:00
parent ebc5a65388
commit db0169521b

View File

@ -6,9 +6,9 @@
.EXAMPLE .EXAMPLE
PS> ./list-cli-tools.ps1 PS> ./list-cli-tools.ps1
Tool Name Version Installation Path TOOL VERSION INSTALLATION PATH
--------- ------- ----------------- ---- ------- -----------------
7z 23.01 /usr/bin/7z (38 bytes) arp 10.0.22621.4111 C:\Windows\system32\ARP.EXE (45K)
... ...
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -53,13 +53,13 @@ function ListTool([string]$Name, [string]$VersionArg) {
} else { } else {
$Size = 0 $Size = 0
} }
New-Object PSObject -Property @{ 'Tool Name'=$Name; 'Version'=$Version; 'Installation Path'="$Path ($(Bytes2String $Size))" } New-Object PSObject -Property @{ 'TOOL'=$Name; 'VERSION'=$Version; 'INSTALLATION PATH'="$Path ($(Bytes2String $Size))" }
} catch { } catch {
return return
} }
} }
function ListTools { function List-CLI-Tools {
ListTool 7z "-version" ListTool 7z "-version"
ListTool ant "-v" ListTool ant "-v"
ListTool apt "--version" ListTool apt "--version"
@ -331,7 +331,7 @@ function ListTools {
} }
try { try {
ListTools | Format-Table -property @{e='Tool Name';width=15},@{e='Version';width=15},@{e='Installation Path';width=90} List-CLI-Tools | Format-Table -property @{e='TOOL';width=15},@{e='VERSION';width=16},@{e='INSTALLATION PATH';width=90}
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"