iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
👻

Released GistGet: A PowerShell module for syncing WinGet packages via Gist

に公開

What is this?

GistGet is a PowerShell module that allows you to synchronize multiple environments by defining the packages you want to install in Gist as YAML.

Definition files can also be specified as local files or URIs, so they can be used for things like setting up development environments for a product.

Define a YAML like the following in Gist.

7zip.7zip:
Microsoft.VisualStudioCode:
  custome: /VERYSILENT /NORESTART /MERGETASKS=!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath

Call Sync-GistGetPackage to synchronize.

Sync-GistGetPackage

When you install a new package...

Install-GistGetPackage -Id Git.Git

The definition file on Gist is also transparently updated. Convenient!

7zip.7zip:
Microsoft.VisualStudioCode:
  custom: /VERYSILENT /NORESTART /MERGETASKS=!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath
Git.Git:

Please give it a try if you'd like.

Getting started

Install the module from the PowerShell Gallery.

Install-Module GistGet

Obtain a token for updating Gist from GitHub and configure it. Refer to this link for the required permissions for the token.

Set-GitHubToken github_pat_11AD3NELA0SGEHcrynCMSo...

Create an installation list in Gist.

At this time, set "Gist description..." to "GistGet". The file name is optional.

7zip.7zip:
Microsoft.VisualStudioCode:
  custom: /VERYSILENT /NORESTART /MERGETASKS=!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath

Synchronize packages according to the Gist definition.

Sync-GistGetPackage

Update all packages (winget upgrade).

Update-GistGetPackage

Install a new package.

Install-GistGetPackage -Id Git.Git

Installing through GistGet commands also updates the definition file on Gist.

7zip.7zip:
Microsoft.VisualStudioCode:
  custom: /VERYSILENT /NORESTART /MERGETASKS=!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath
Git.Git:

This allows you to easily synchronize environments by running Sync-GistGetPackage on another machine.

Uninstall an installed package.

Uninstall-GistGetPackage -Id Git.Git

The definition file on Gist will also be synchronized.

7zip.7zip:
Microsoft.VisualStudioCode:
  custom: /VERYSILENT /NORESTART /MERGETASKS=!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath
Git.Git:
  uninstall: true

By running Sync-GistGetPackage on another machine, it will also be uninstalled from that machine.

If you do not want to synchronize the uninstallation, please use the standard WinGet command.

winget uninstall --id Git.Git

Please check the documentation for detailed specifications!

Discussion