Skip to content

Commit

Permalink
Show packages through winget (#85)
Browse files Browse the repository at this point in the history
* Show packages through winget

* Disable winget by default
  • Loading branch information
rashil2000 authored Jun 12, 2021
1 parent 85f9460 commit f4d0eb9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions winfetch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
.PARAMETER showdisks
Configure which disks are shown, use '-showdisks *' to show all.
.PARAMETER showpkgs
Configure which package managers are shown, e.g. '-showpkgs scoop,choco'.
Configure which package managers are shown, e.g. '-showpkgs winget,scoop,choco'.
.INPUTS
System.String
.OUTPUTS
Expand Down Expand Up @@ -236,7 +236,7 @@ $defaultConfig = @'
# Configure which package managers are shown
# disabling unused ones will improve speed
# $ShowPkgs = @("scoop", "choco")
# $ShowPkgs = @("winget", "scoop", "choco")
# Configure how to show info for levels
# Default is for text only.
Expand Down Expand Up @@ -663,6 +663,14 @@ function info_pwsh {
function info_pkgs {
$pkgs = @()

if ("winget" -in $ShowPkgs -and (Get-Command -Name winget -ErrorAction Ignore)) {
$wingetpkg = (winget list | Where-Object {$_.Trim("`n`r`t`b-\|/ ").Length -ne 0} | Measure-Object).Count - 1

if ($wingetpkg) {
$pkgs += "$wingetpkg"
}
}

if ("choco" -in $ShowPkgs -and (Get-Command -Name choco -ErrorAction Ignore)) {
$chocopkg = (& clist -l)[-1].Split(' ')[0] - 1

Expand Down

0 comments on commit f4d0eb9

Please sign in to comment.