Skip to content

Instantly share code, notes, and snippets.

@CurlyBytes
Forked from denalena/coco.ps1
Created March 18, 2021 14:25
Show Gist options
  • Select an option

  • Save CurlyBytes/ae02fbd3c9b1b9be51b89a879d733bf9 to your computer and use it in GitHub Desktop.

Select an option

Save CurlyBytes/ae02fbd3c9b1b9be51b89a879d733bf9 to your computer and use it in GitHub Desktop.

Revisions

  1. @denalena denalena revised this gist Aug 29, 2019. 1 changed file with 11 additions and 2 deletions.
    13 changes: 11 additions & 2 deletions coco.ps1
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,11 @@ function listInstalledPrograms() {
    choco list --local --id-only --limit-output
    }

    function dumpInstalledPrograms() {
    listInstalledPrograms | Out-File -FilePath $file
    Write-Host "dumped program list to $file"
    }

    switch ($command) {
    install {
    if (Test-Path $file) {
    @@ -25,8 +30,12 @@ switch ($command) {
    }

    dump {
    listInstalledPrograms | Out-File -FilePath $file
    Write-Host "dumped program list to $file"
    dumpInstalledPrograms
    }

    update {
    choco upgrade -y all
    dumpInstalledPrograms
    }

    default {
  2. @denalena denalena revised this gist Jul 25, 2019. No changes.
  3. @denalena denalena revised this gist Jul 25, 2019. No changes.
  4. @denalena denalena created this gist Jun 16, 2019.
    35 changes: 35 additions & 0 deletions coco.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    param (
    [string]$command = "",
    [string]$file = "coco.txt"
    )

    function listInstalledPrograms() {
    choco list --local --id-only --limit-output
    }

    switch ($command) {
    install {
    if (Test-Path $file) {
    choco upgrade -y (Get-Content $file)
    }
    }

    uninstall {
    if (Test-Path $file) {
    choco uninstall -y (Get-Content $file)
    }
    }

    list {
    listInstalledPrograms
    }

    dump {
    listInstalledPrograms | Out-File -FilePath $file
    Write-Host "dumped program list to $file"
    }

    default {
    Write-Host "usage: install|uninstall|dump [file]"
    }
    }