winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

VersionCommand.cs (1326B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="VersionCommand.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.WinGet.Client.Engine.Commands
      8 {
      9     using System.Management.Automation;
     10     using Microsoft.WinGet.Client.Engine.Commands.Common;
     11     using Microsoft.WinGet.Client.Engine.Helpers;
     12     using Microsoft.WinGet.Common.Command;
     13 
     14     /// <summary>
     15     /// Version commands.
     16     /// </summary>
     17     public sealed class VersionCommand : ManagementDeploymentCommand
     18     {
     19         /// <summary>
     20         /// Initializes a new instance of the <see cref="VersionCommand"/> class.
     21         /// </summary>
     22         /// <param name="psCmdlet">The caller cmdlet.</param>
     23         public VersionCommand(PSCmdlet psCmdlet)
     24             : base(psCmdlet)
     25         {
     26         }
     27 
     28         /// <summary>
     29         /// Get-WinGetVersion. Gets the currently installed winget version.
     30         /// </summary>
     31         public void Get()
     32         {
     33             this.Write(StreamType.Object, this.Execute(() => WinGetVersion.InstalledWinGetVersion(this).TagVersion));
     34         }
     35     }
     36 }