GetWinGetConfigurationCmdlet.cs (2277B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="GetWinGetConfigurationCmdlet.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 Microsoft.WinGet.Configuration.Cmdlets.Common; 11 using Microsoft.WinGet.Configuration.Engine.Commands; 12 13 /// <summary> 14 /// Get-WinGetConfiguration. 15 /// Opens a configuration set. 16 /// </summary> 17 [Cmdlet(VerbsCommon.Get, "WinGetConfiguration", DefaultParameterSetName = Helpers.Constants.ParameterSet.OpenConfigurationSetFromFile)] 18 [Alias("gwgc")] 19 public sealed class GetWinGetConfigurationCmdlet : OpenConfiguration 20 { 21 /// <summary> 22 /// Opens the configuration set. 23 /// </summary> 24 protected override void ProcessRecord() 25 { 26 var configCommand = new ConfigurationCommand(this); 27 28 if (this.ParameterSetName == Helpers.Constants.ParameterSet.OpenConfigurationSetFromFile) 29 { 30 configCommand.Get( 31 this.File, 32 this.ModulePath, 33 this.ExecutionPolicy, 34 this.ProcessorPath, 35 this.CanUseTelemetry); 36 } 37 else if (this.ParameterSetName == Helpers.Constants.ParameterSet.OpenConfigurationSetFromHistory) 38 { 39 configCommand.GetFromHistory( 40 this.InstanceIdentifier, 41 this.ModulePath, 42 this.ExecutionPolicy, 43 this.ProcessorPath, 44 this.CanUseTelemetry); 45 } 46 else if (this.ParameterSetName == Helpers.Constants.ParameterSet.OpenAllConfigurationSetsFromHistory) 47 { 48 configCommand.GetAllFromHistory( 49 this.ModulePath, 50 this.ExecutionPolicy, 51 this.ProcessorPath, 52 this.CanUseTelemetry); 53 } 54 } 55 } 56 }