From 43bbf406d7c9ea1fd9870749138140c806de6b15 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 10 Oct 2023 15:17:37 +0200 Subject: [PATCH] Update list-cli-tools.ps1 --- Data/Abbr/astronomy.csv | 5 ----- Data/Abbr/computing.csv | 3 +-- Data/Abbr/general.csv | 2 +- Scripts/list-cli-tools.ps1 | 24 ++++++++++++++++++------ 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Data/Abbr/astronomy.csv b/Data/Abbr/astronomy.csv index 1b9611da..49e31544 100644 --- a/Data/Abbr/astronomy.csv +++ b/Data/Abbr/astronomy.csv @@ -57,24 +57,19 @@ BLAST,Balloon-borne Large Aperture Submillimeter Telescope BlackGEM,(La Silla) Telescope array searching for optical counterparts of gravitational wave sources BLIP,Background photon noise limited C2PAP,"Computational Center for Particle and Astrophysics, Universe Cluster, Garching" -CAD,Computer Aided Design CADC,Canadian Astronomy Data Centre CAPj,Communicating Astronomy with the Public Journal CARLA,Clusters Around Radio-Loud AGN (Spitzer) CASA,Common Astronomy Software Applications (ALMA) CBR,cosmic background radiation -CCD,Charge Coupled Device CDR,Critical Design Review CDS,"Centre de Données astronomiques de Strasbourg (Strasbourg astronomical Data Center)" CEA,"Commissariat à L’Energie Atomique, France" CELAC_EU,"Summit of the Community of Latin American and Caribbean States–European Union" CES,Coude Echelle Spectrometer -CfP,Call for Proposal -CfT,Call for tender CGM,Circumgalactic medium CHAMP+,Dual channel heterodyne receiver array (APEX) CLIF,Convolution with Linearized Inverse Filter algorithm for wavefront sensing -CLP,Chilean Peso CM,center of mass CMB,Cosmic Microwave Background CMBR,Cosmic Microwave Background Radiation diff --git a/Data/Abbr/computing.csv b/Data/Abbr/computing.csv index eda98810..3af7734b 100644 --- a/Data/Abbr/computing.csv +++ b/Data/Abbr/computing.csv @@ -433,8 +433,7 @@ CBT,Changed Block Tracking CBT,Computer-Based Training CC,Common Criteria CCB,Change Control Board -CCD,charge-coupled device -CCD,Continuity of Care Document +CCD,"Charge-Coupled Device, Continuity of Care Document" CCEVS,Common Criteria Evaluation and Validation Scheme for IT Security CCIE,Cisco Certified Internetwork Expert CCITT,ITU-T Telecommunication Standardization Sector of the International Telecommunications diff --git a/Data/Abbr/general.csv b/Data/Abbr/general.csv index 9dd2c0e1..6aa588d0 100644 --- a/Data/Abbr/general.csv +++ b/Data/Abbr/general.csv @@ -670,7 +670,7 @@ CC,carbon copy CCA,Counter Command Activity CCC,"Canterbury Clothing Company,Civilian Conservation Corps (U.S.,1930s and 1940s),Corpus Christi College,Oxford" CCCP,"Central Committee of the Communist Party,Cyrillic for SSSR (Soyuz Sovetskikh Sotsialisticheskikh Respublik,Russian Союз Советских Социалистических Республик,Union of Soviet Socialist Republics)" -CCD,"Charge-Coupled Device,Confraternity of Christian Doctrine (Catechism)" +CCD,Confraternity of Christian Doctrine (Catechism) CCF,Cartoon Cartoon Fridays CCG,"Canadian Coast Guard,Collectible Card Game" CCGC,"Canadian Coast Guard Cutter,Canadian Coast Guard College" diff --git a/Scripts/list-cli-tools.ps1 b/Scripts/list-cli-tools.ps1 index 73ef0c1c..1eafbf39 100755 --- a/Scripts/list-cli-tools.ps1 +++ b/Scripts/list-cli-tools.ps1 @@ -6,9 +6,9 @@ .EXAMPLE PS> ./list-cli-tools.ps1 - Tool Version Path FileSize - ---- ------- ---- -------- - at 10.0.19041.1 C:\WINDOWS\system32\at.exe 31232 + CLI-Tool Version Location + -------- ------- -------- + at 10.0.19041.1 C:\WINDOWS\system32\at.exe (31K) ... .LINK https://github.com/fleschutz/PowerShell @@ -16,7 +16,19 @@ Author: Markus Fleschutz | License: CC0 #> -function ListTool { param([string]$Name, [string]$VersionArg) +function Bytes2String([int64]$bytes) { + if ($bytes -lt 1000) { return "$bytes bytes" } + $bytes /= 1000 + if ($bytes -lt 1000) { return "$($bytes)K" } + $bytes /= 1000 + if ($bytes -lt 1000) { return "$($bytes)MB" } + $bytes /= 1000 + if ($bytes -lt 1000) { return "$($bytes)GB" } + $bytes /= 1000 + return "$($Bytes)TB" +} + +function ListTool([string]$Name, [string]$VersionArg) { try { $Info = Get-Command $Name -ErrorAction Stop $Path = $Info.Source @@ -41,7 +53,7 @@ function ListTool { param([string]$Name, [string]$VersionArg) } else { $Size = 0 } - New-Object PSObject -Property @{ Tool=$Name; Version=$Version; Path=$Path; FileSize=$Size } + New-Object PSObject -Property @{ 'CLI-Tool'=$Name; Version=$Version; Location="$Path ($(Bytes2String $Size))" } } catch { return } @@ -313,7 +325,7 @@ function ListTools { } try { - ListTools | Format-Table -property @{e='Tool';width=12},@{e='Version';width=15},@{e='Path';width=70},@{e='FileSize';width=10} + ListTools | Format-Table -property @{e='CLI-Tool';width=14},@{e='Version';width=17},@{e='Location';width=90} exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"