mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-05 20:39:38 +01:00
Update list-cli-tool.ps1
This commit is contained in:
parent
68eac507e4
commit
f8e95672d4
@ -16,9 +16,9 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function ListTool { param([string]$Cmd, [string]$VersionArg)
|
function ListTool { param([string]$Name, [string]$VersionArg)
|
||||||
try {
|
try {
|
||||||
$Info = Get-Command $Cmd -ErrorAction Stop
|
$Info = Get-Command $Name -ErrorAction Stop
|
||||||
$Path = $Info.Source
|
$Path = $Info.Source
|
||||||
if ("$($Info.Version)" -eq "0.0.0.0") {
|
if ("$($Info.Version)" -eq "0.0.0.0") {
|
||||||
if ("$VersionArg" -ne "") {
|
if ("$VersionArg" -ne "") {
|
||||||
@ -37,11 +37,11 @@ function ListTool { param([string]$Cmd, [string]$VersionArg)
|
|||||||
$Version = $Info.Version
|
$Version = $Info.Version
|
||||||
}
|
}
|
||||||
if (Test-Path "$Path" -pathType leaf) {
|
if (Test-Path "$Path" -pathType leaf) {
|
||||||
$FileSize = (Get-Item "$Path").Length
|
$Size = (Get-Item "$Path").Length
|
||||||
} else {
|
} else {
|
||||||
$FileSize = "0"
|
$Size = 0
|
||||||
}
|
}
|
||||||
New-Object PSObject -Property @{ Tool=$Cmd; Version=$Version; Path=$Path; FileSize=$FileSize }
|
New-Object PSObject -Property @{ Tool=$Name; Version=$Version; Path=$Path; FileSize=$Size }
|
||||||
} catch {
|
} catch {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user