-
Notifications
You must be signed in to change notification settings - Fork 262
Expand file tree
/
Copy pathProgram.cs
More file actions
29 lines (23 loc) · 705 Bytes
/
Copy pathProgram.cs
File metadata and controls
29 lines (23 loc) · 705 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
// Copyright (c) Nate McMaster.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Hosting;
class Program
{
static Task<int> Main(string[] args)
=> new HostBuilder()
.RunCommandLineApplicationAsync<Program>(args);
[Option]
public int Port { get; } = 8080;
private IHostEnvironment _env;
public Program(IHostEnvironment env)
{
_env = env;
}
private void OnExecute()
{
Console.WriteLine($"Starting on port {Port}, env = {_env.EnvironmentName}");
}
}