GetSourceCmdlet.cs (1413B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="GetSourceCmdlet.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGet.Client.Commands 8 { 9 using System.Management.Automation; 10 using Microsoft.WinGet.Client.Common; 11 using Microsoft.WinGet.Client.Engine.Commands; 12 using Microsoft.WinGet.Client.Engine.PSObjects; 13 14 /// <summary> 15 /// Retrieves the list of configured sources. 16 /// </summary> 17 [Cmdlet(VerbsCommon.Get, Constants.WinGetNouns.Source)] 18 [Alias("gwgso")] 19 [OutputType(typeof(PSSourceResult))] 20 public sealed class GetSourceCmdlet : PSCmdlet 21 { 22 /// <summary> 23 /// Gets or sets the name of the source to retrieve. 24 /// </summary> 25 [Parameter( 26 Position = 0, 27 ValueFromPipeline = true, 28 ValueFromPipelineByPropertyName = true)] 29 public string Name { get; set; } 30 31 /// <summary> 32 /// Returns the list of configured sources. 33 /// </summary> 34 protected override void ProcessRecord() 35 { 36 var command = new SourceCommand(this); 37 command.Get(this.Name); 38 } 39 } 40 }