-
Notifications
You must be signed in to change notification settings - Fork 2
/
Program.cs
38 lines (30 loc) · 1.22 KB
/
Program.cs
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
30
31
32
33
34
35
36
37
38
// Copyright (c) Thomas Gossler. All rights reserved.
// Licensed under the MIT license.
#nullable disable warnings
using System;
using Spectre.Console.Cli;
namespace WebPageHost;
/// <summary>
/// Command line interface tool for opening web pages in a WebView2 control.
/// </summary>
internal static class Program
{
[STAThread]
private static int Main(string[] args)
{
var app = new CommandApp();
app.Configure(config => {
_ = config.SetApplicationName("WebPageHost");
_ = config.AddCommand<OpenCommand>("open")
.WithDescription("Opens the URL in a new window with an embedded web browser.")
.WithExample(new[] { "open", "--help" })
.WithExample(new[] { "open", "https://www.google.com/", "--zoomfactor", "0.6" })
.WithExample(new[] { "open", "https://www.google.com/", "-x", "document.title" });
_ = config.AddCommand<CleanupCommand>("cleanup")
.WithDescription("Resets the current user's web browser persistent data folder and registry settings.")
.WithExample(new[] { "cleanup" });
_ = config.ValidateExamples();
});
return app.Run(args);
}
}