-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
38 lines (33 loc) · 1.02 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
using System;
using System.Text;
using System.Threading.Tasks;
using DotNetEnv;
using Spectre.Console.Cli;
using cweather.CommandLine;
namespace cweather
{
class Program
{
static async Task Main(string[] args)
{
// Loading environmental variables from .env file
Env.Load();
// Setting text encoding of the terminal to utf8 to render everything properly
Console.OutputEncoding = Encoding.UTF8;
//Commandline parsing
var app = new CommandApp();
app.Configure(config =>
{
config.AddBranch<ForecastSettings>("fcast", fcast =>
{
fcast.AddCommand<DailyCommand>("daily");
fcast.AddCommand<HourlyCommand>("hourly");
});
config.AddCommand<SetCommand>("set");
config.AddCommand<CurrCommand>("curr");
}
);
await app.RunAsync(args);
}
}
}