mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-28 15:46:35 +01:00
Improve list-cli-tools.ps1
This commit is contained in:
parent
951c18a370
commit
96d2838232
@ -11,25 +11,57 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function CheckTool { param([string]$Name, [string]$Arg)
|
function CheckFor { param([string]$Cmd)
|
||||||
$Version = (git $Arg)
|
try {
|
||||||
if ($lastExitCode -ne "0") { return }
|
$Info = Get-Command $Cmd -ErrorAction Stop
|
||||||
|
$Location = $Info.Source
|
||||||
$Location = (which $Name)
|
if (test-path "$Location" -pathType leaf) {
|
||||||
if ($lastExitCode -ne "0") { return }
|
$FileSize = (Get-Item "$Location").Length
|
||||||
|
} else {
|
||||||
new-object PSObject -Property @{ Name=$Name; Version=$Version; Location=$Location }
|
$FileSize = "0"
|
||||||
|
}
|
||||||
|
new-object PSObject -Property @{ Name=$Cmd; Version=$Info.Version; Location=$Location; FileSize=$FileSize }
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ListTools {
|
function ListTools {
|
||||||
"Checking CLI tools ..."
|
CheckFor at
|
||||||
CheckTool git "--version"
|
CheckFor curl
|
||||||
CheckTool ipfs "--version"
|
CheckFor find
|
||||||
CheckTool wget "--version"
|
CheckFor git
|
||||||
|
CheckFor help
|
||||||
|
CheckFor ipfs
|
||||||
|
CheckFor ping
|
||||||
|
CheckFor ping6
|
||||||
|
CheckFor regedit
|
||||||
|
CheckFor replace
|
||||||
|
CheckFor robocopy
|
||||||
|
CheckFor rundll32
|
||||||
|
CheckFor ssh
|
||||||
|
CheckFor ssh-keygen
|
||||||
|
CheckFor sort
|
||||||
|
CheckFor tar
|
||||||
|
CheckFor tasklist
|
||||||
|
CheckFor tskill
|
||||||
|
CheckFor tzsync
|
||||||
|
CheckFor vulkaninfo
|
||||||
|
CheckFor waitfor
|
||||||
|
CheckFor wget
|
||||||
|
CheckFor where
|
||||||
|
CheckFor which
|
||||||
|
CheckFor whoami
|
||||||
|
CheckFor wput
|
||||||
|
CheckFor write
|
||||||
|
CheckFor xcopy
|
||||||
|
CheckFor zip
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ListTools | format-table
|
"List of Command-line Tools Available"
|
||||||
|
"===================================="
|
||||||
|
ListTools | format-table -property Name,Version,Location,FileSize
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user