mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-11 17:20:48 +01:00
Updated list-cli-tools.ps1
This commit is contained in:
parent
ebc5a65388
commit
db0169521b
@ -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])"
|
||||||
|
Loading…
Reference in New Issue
Block a user