File tree Expand file tree Collapse file tree 2 files changed +44
-7
lines changed
Expand file tree Collapse file tree 2 files changed +44
-7
lines changed Original file line number Diff line number Diff line change 66 <RootNamespace >Open_Rails_Code_Bot</RootNamespace >
77 </PropertyGroup >
88
9+ <ItemGroup >
10+ <PackageReference Include =" CommandLineArgumentsParser" Version =" 3.0.20" />
11+ <PackageReference Include =" Microsoft.Extensions.Configuration.Json" Version =" 2.2.0" />
12+ <PackageReference Include =" Newtonsoft.Json" Version =" 12.0.2" />
13+ </ItemGroup >
14+
915</Project >
Original file line number Diff line number Diff line change 11using System ;
2+ using System . IO ;
3+ using System . Threading . Tasks ;
4+ using Microsoft . Extensions . Configuration ;
25
36namespace Open_Rails_Code_Bot
47{
5- class Program
6- {
7- static void Main ( string [ ] args )
8- {
9- Console . WriteLine ( "Hello World!" ) ;
10- }
11- }
8+ class Program
9+ {
10+ static void Main ( string [ ] args )
11+ {
12+ var config = new CommandLineParser . Arguments . FileArgument ( 'c' , "config" )
13+ {
14+ DefaultValue = new FileInfo ( "config.json" )
15+ } ;
16+
17+ var commandLineParser = new CommandLineParser . CommandLineParser ( )
18+ {
19+ Arguments = {
20+ config ,
21+ }
22+ } ;
23+
24+ try
25+ {
26+ commandLineParser . ParseCommandLine ( args ) ;
27+
28+ AsyncMain ( new ConfigurationBuilder ( )
29+ . AddJsonFile ( config . Value . FullName , true )
30+ . Build ( ) ) . Wait ( ) ;
31+ }
32+ catch ( CommandLineParser . Exceptions . CommandLineException e )
33+ {
34+ Console . WriteLine ( e . Message ) ;
35+ }
36+ }
37+
38+ static async Task AsyncMain ( IConfigurationRoot config )
39+ {
40+ // TODO:
41+ }
42+ }
1243}
You can’t perform that action at this time.
0 commit comments