@@ -94,28 +94,26 @@ public static async Task Main(string[] args)
9494 {
9595 var rootCommand = new RootCommand ( "Java to C# Converter" )
9696 {
97- Description = "A syntactic transformer of source code from Java to C#."
97+ Description = "A syntactic transformer of source code from Java to C#." ,
9898 } ;
9999
100- rootCommand . Add ( CreateFileCommand ( ) ) ;
101- rootCommand . Add ( CreateDirectoryCommand ( ) ) ;
100+ rootCommand . Subcommands . Add ( CreateFileCommand ( ) ) ;
101+ rootCommand . Subcommands . Add ( CreateDirectoryCommand ( ) ) ;
102102
103- rootCommand . Add ( _includeSubdirectoriesOption ) ;
104- rootCommand . Add ( _includeUsingsOption ) ;
105- rootCommand . Add ( _includeNamespaceOption ) ;
106- rootCommand . Add ( _includeCommentsOption ) ;
107- rootCommand . Add ( _useDebugAssertOption ) ;
108- rootCommand . Add ( _startInterfaceNamesWithIOption ) ;
109- rootCommand . Add ( _commentUnrecognizedCodeOption ) ;
110- rootCommand . Add ( _systemOutToConsoleOption ) ;
111- rootCommand . Add ( _fileScopedNamespacesOption ) ;
112- rootCommand . Add ( _clearDefaultUsingsOption ) ;
113- rootCommand . Add ( _addUsingsOption ) ;
114- rootCommand . Add ( _mappingsFileNameOption ) ;
103+ rootCommand . Options . Add ( _includeSubdirectoriesOption ) ;
104+ rootCommand . Options . Add ( _includeUsingsOption ) ;
105+ rootCommand . Options . Add ( _includeNamespaceOption ) ;
106+ rootCommand . Options . Add ( _includeCommentsOption ) ;
107+ rootCommand . Options . Add ( _useDebugAssertOption ) ;
108+ rootCommand . Options . Add ( _startInterfaceNamesWithIOption ) ;
109+ rootCommand . Options . Add ( _commentUnrecognizedCodeOption ) ;
110+ rootCommand . Options . Add ( _systemOutToConsoleOption ) ;
111+ rootCommand . Options . Add ( _fileScopedNamespacesOption ) ;
112+ rootCommand . Options . Add ( _clearDefaultUsingsOption ) ;
113+ rootCommand . Options . Add ( _addUsingsOption ) ;
114+ rootCommand . Options . Add ( _mappingsFileNameOption ) ;
115115
116- var parseResult = rootCommand . Parse ( args ) ;
117-
118- await parseResult . InvokeAsync ( ) ;
116+ await rootCommand . Parse ( args ) . InvokeAsync ( ) ;
119117
120118 // flush logs
121119 _loggerFactory . Dispose ( ) ;
@@ -258,13 +256,17 @@ private static void ConvertToCSharpDir(DirectoryInfo inputDirectory, DirectoryIn
258256 }
259257 }
260258 else
259+ {
261260 _logger . LogError ( "Java input folder {path} doesn't exist!" , inputDirectory ) ;
261+ }
262262 }
263263
264264 private static void ConvertToCSharpFile ( FileSystemInfo inputFile , FileSystemInfo ? outputFile , JavaConversionOptions options , bool overwrite = true )
265265 {
266266 if ( ! overwrite && outputFile is { Exists : true } )
267+ {
267268 _logger . LogInformation ( "{outputFilePath} exists, skip to next." , outputFile ) ;
269+ }
268270 else if ( inputFile . Exists )
269271 {
270272 try
@@ -302,7 +304,9 @@ private static void ConvertToCSharpFile(FileSystemInfo inputFile, FileSystemInfo
302304 }
303305 }
304306 else
307+ {
305308 _logger . LogError ( "Java input file {filePath} doesn't exist!" , inputFile . FullName ) ;
309+ }
306310 }
307311
308312 private static void OutputFileOrPrint ( string ? fileName , string contents )
0 commit comments