/ src / modules / cmdpal / ext / Microsoft.CmdPal.Ext.System / ExecuteCommand.cs
ExecuteCommand.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  using System;
 6  using Microsoft.CommandPalette.Extensions.Toolkit;
 7  
 8  namespace Microsoft.CmdPal.Ext.System;
 9  
10  public sealed partial class ExecuteCommand : InvokableCommand
11  {
12      public ExecuteCommand(Action command)
13      {
14          _command = command;
15      }
16  
17      public override CommandResult Invoke()
18      {
19          _command();
20          return CommandResult.Dismiss();
21      }
22  
23      private Action _command;
24  }