@@ -43,17 +43,15 @@ public static void Empty(this DirectoryInfo directory)
4343 subDirectory . Delete ( true ) ;
4444 }
4545
46- public static void Main ( )
46+ public static int Main ( )
4747 {
4848 string [ ] args = Environment . GetCommandLineArgs ( ) ;
4949
5050 if ( args . Length == 1 )
5151 {
5252 Console . Error . WriteLine ( "Invalid command line (missing folder path)!" ) ;
5353
54- Environment . ExitCode = ( int ) ERROR_CODES . INVALID_COMMAND_LINE ;
55-
56- return ;
54+ return ( int ) ERROR_CODES . INVALID_COMMAND_LINE ;
5755 }
5856
5957 string folder = args [ 1 ] ;
@@ -62,18 +60,14 @@ public static void Main()
6260 {
6361 Console . Error . WriteLine ( "Provided folder path is null or empty!" ) ;
6462
65- Environment . ExitCode = ( int ) ERROR_CODES . BAD_ARGUMENTS ;
66-
67- return ;
63+ return ( int ) ERROR_CODES . BAD_ARGUMENTS ;
6864 }
6965
7066 if ( ! Directory . Exists ( folder ) )
7167 {
7268 Console . Error . WriteLine ( "Provided folder '" + folder + "' does not exists!" ) ;
7369
74- Environment . ExitCode = ( int ) ERROR_CODES . NOT_EXISTS ;
75-
76- return ;
70+ return ( int ) ERROR_CODES . NOT_EXISTS ;
7771 }
7872
7973 if ( args . Length > 2 )
@@ -125,7 +119,7 @@ public static void Main()
125119 {
126120 WriteDebugInfo ( "Finished checking the documentation." ) ;
127121
128- return ;
122+ return Environment . ExitCode ;
129123 }
130124
131125 // Generate Folders
@@ -146,6 +140,8 @@ public static void Main()
146140 GenerateJSONSearch ( wrapperList , globalsDict ) ;
147141
148142 WriteDebugInfo ( "Finished generating the documentation." ) ;
143+
144+ return Environment . ExitCode ;
149145 }
150146
151147#pragma warning disable IDE0060 // Nicht verwendete Parameter entfernen
@@ -169,11 +165,7 @@ internal static void WriteDebugInfo(string debugInfo)
169165 internal static void WriteErrors ( string title , List < string > errors , string relPath , int ? foundLine , int ? exitCode )
170166 {
171167 if ( exitCode != null )
172- {
173- Console . WriteLine ( "Error " + exitCode ) ;
174-
175168 Environment . ExitCode = ( int ) exitCode ;
176- }
177169
178170 ConsoleColor oldColor = Console . ForegroundColor ;
179171
@@ -183,13 +175,13 @@ internal static void WriteErrors(string title, List<string> errors, string relPa
183175
184176 StringBuilder errorBuilder = new StringBuilder ( ) ;
185177
186- errorBuilder . AppendLine ( ( relPath ?? "?" ) + ": [Warning] line " + ( foundLine != null ? ( ( int ) foundLine ) . ToString ( ) : "?" ) + ": " + title ) ;
178+ errorBuilder . Append ( " \n Error " + ( exitCode != null ? ( ( int ) exitCode ) . ToString ( ) : "???" ) + ": " + ( relPath ?? "?" ) + ": [Warning] line " + ( foundLine != null ? ( ( int ) foundLine ) . ToString ( ) : "?" ) + ": " + title ) ;
187179
188180 if ( errors != null )
189181 foreach ( string error in errors )
190- errorBuilder . AppendLine ( error ) ;
182+ errorBuilder . Append ( " \n " + error ) ;
191183
192- textWriter . WriteLine ( errorBuilder . ToString ( ) ) ;
184+ textWriter . WriteLine ( errorBuilder . Append ( " \n " ) . ToString ( ) ) ;
193185
194186 Console . ForegroundColor = oldColor ;
195187 }
0 commit comments