winget-cli

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

GetWinGetConfigurationDetailsCmdlet.cs (1917B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="GetWinGetConfigurationDetailsCmdlet.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.WinGet.Configuration.Cmdlets
      8 {
      9     using System.Management.Automation;
     10     using System.Threading;
     11     using Microsoft.WinGet.Configuration.Engine.Commands;
     12     using Microsoft.WinGet.Configuration.Engine.PSObjects;
     13 
     14     /// <summary>
     15     /// Get-WinGetConfigurationDetails.
     16     /// Gets the details for the units in a configuration set.
     17     /// </summary>
     18     [Cmdlet(VerbsCommon.Get, "WinGetConfigurationDetails")]
     19     [Alias("gwgcd")]
     20     public sealed class GetWinGetConfigurationDetailsCmdlet : PSCmdlet
     21     {
     22         private ConfigurationCommand runningCommand = null;
     23 
     24         /// <summary>
     25         /// Gets or sets the configuration set.
     26         /// </summary>
     27         [Parameter(
     28             Position = 0,
     29             Mandatory = true,
     30             ValueFromPipeline = true,
     31             ValueFromPipelineByPropertyName = true)]
     32         public PSConfigurationSet Set { get; set; }
     33 
     34         /// <summary>
     35         /// Starts configuration and wait for it to complete.
     36         /// </summary>
     37         protected override void ProcessRecord()
     38         {
     39             this.runningCommand = new ConfigurationCommand(this);
     40             this.runningCommand.GetDetails(this.Set);
     41         }
     42 
     43         /// <summary>
     44         /// Interrupts currently running code within the command.
     45         /// </summary>
     46         protected override void StopProcessing()
     47         {
     48             if (this.runningCommand != null)
     49             {
     50                 this.runningCommand.Cancel();
     51             }
     52         }
     53     }
     54 }