winget-cli

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

RemoveSourceCmdlet.cs (1325B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="RemoveSourceCmdlet.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.WinGet.Client.Cmdlets
      8 {
      9     using System.Management.Automation;
     10     using Microsoft.WinGet.Client.Common;
     11     using Microsoft.WinGet.Client.Engine.Commands;
     12 
     13     /// <summary>
     14     /// Removes a source. Requires admin.
     15     /// </summary>
     16     [Cmdlet(VerbsCommon.Remove, Constants.WinGetNouns.Source)]
     17     [Alias("rwgs")]
     18     public sealed class RemoveSourceCmdlet : PSCmdlet
     19     {
     20         /// <summary>
     21         /// Gets or sets the name of the source to remove.
     22         /// </summary>
     23         [Parameter(
     24             Position = 0,
     25             Mandatory = true,
     26             ValueFromPipeline = true,
     27             ValueFromPipelineByPropertyName = true)]
     28         public string Name { get; set; }
     29 
     30         /// <summary>
     31         /// Removes source.
     32         /// </summary>
     33         protected override void ProcessRecord()
     34         {
     35             var command = new CliCommand(this);
     36             command.RemoveSource(this.Name);
     37         }
     38     }
     39 }