/ src / modules / cmdpal / ext / Microsoft.CmdPal.Ext.WindowsTerminal / WindowsTerminalCommandsProvider.cs
WindowsTerminalCommandsProvider.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 Microsoft.CmdPal.Ext.WindowsTerminal.Helpers;
 6  using Microsoft.CmdPal.Ext.WindowsTerminal.Properties;
 7  using Microsoft.CommandPalette.Extensions;
 8  using Microsoft.CommandPalette.Extensions.Toolkit;
 9  
10  namespace Microsoft.CmdPal.Ext.WindowsTerminal;
11  
12  public partial class WindowsTerminalCommandsProvider : CommandProvider
13  {
14      private readonly TerminalTopLevelCommandItem _terminalCommand;
15      private readonly SettingsManager _settingsManager = new();
16      private readonly AppSettingsManager _appSettingsManager = new();
17  
18      public WindowsTerminalCommandsProvider()
19      {
20          Id = "WindowsTerminalProfiles";
21          DisplayName = Resources.extension_name;
22          Icon = Icons.TerminalIcon;
23          Settings = _settingsManager.Settings;
24  
25          _terminalCommand = new TerminalTopLevelCommandItem(_settingsManager, _appSettingsManager)
26          {
27              MoreCommands = [
28                  new CommandContextItem(Settings.SettingsPage),
29              ],
30          };
31      }
32  
33      public override ICommandItem[] TopLevelCommands() => [_terminalCommand];
34  }