-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathOpenHomePageCommand.cs
More file actions
29 lines (23 loc) · 998 Bytes
/
OpenHomePageCommand.cs
File metadata and controls
29 lines (23 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using Microsoft.CommandPalette.Extensions.Toolkit;
using WebSearchShortcut.Browsers;
namespace WebSearchShortcut.Commands;
internal sealed partial class OpenHomePageCommand : InvokableCommand
{
private readonly WebSearchShortcutDataEntry _shortcut;
private readonly BrowserExecutionInfo _browserInfo;
internal OpenHomePageCommand(WebSearchShortcutDataEntry shortcut)
{
Name = $"[UNBOUND] {nameof(OpenHomePageCommand)}.{nameof(Name)} required - shortcut='{shortcut.Name}'";
_shortcut = shortcut;
_browserInfo = new BrowserExecutionInfo(shortcut);
}
public override CommandResult Invoke()
{
if (!ShellHelpers.OpenCommandInShell(_browserInfo.Path, _browserInfo.ArgumentsPattern, WebSearchShortcutDataEntry.GetHomePageUrl(_shortcut)))
{
// TODO GH# 138 --> actually display feedback from the extension somewhere.
return CommandResult.KeepOpen();
}
return CommandResult.Dismiss();
}
}