mirror of
https://github.com/aphrody-labs/NuGet.Client.git
synced 2026-10-18 05:06:14 +00:00
24 lines
794 B
C#
24 lines
794 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|||
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||
|
|
|
||
|
|
using System.Management.Automation;
|
||
|
|
using Microsoft.VisualStudio.Shell;
|
||
|
|
using Task = System.Threading.Tasks.Task;
|
||
|
|
|
||
|
|
namespace API.Test.Cmdlets
|
||
|
|
{
|
||
|
|
[Cmdlet(VerbsLifecycle.Invoke, "ShellCommand")]
|
||
|
|
public sealed class InvokeShellCommand : TestExtensionCmdlet
|
||
|
|
{
|
||
|
|
[Parameter(Mandatory = true, Position = 0)]
|
||
|
|
public string CommandName { get; set; }
|
||
|
|
|
||
|
|
protected override async Task ProcessRecordAsync()
|
||
|
|
{
|
||
|
|
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
|
||
|
|
|
||
|
|
var dte = ServiceLocator.GetDTE();
|
||
|
|
dte.ExecuteCommand(CommandName);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|