@@ -22,7 +22,7 @@ public static async Task Main(string[] args)
2222 args = args . Select ( s => s ?? "" ) . ToArray ( ) ;
2323
2424 string apiToken = args [ 0 ] ;
25- string outputFile = args [ 1 ] ;
25+ string outputDirectoryOrFile = args [ 1 ] ;
2626
2727 // Extract input files, formats, and dynamic properties
2828 var parametersCount = args . Count ( x => x . Contains ( '=' ) ) ;
@@ -38,7 +38,7 @@ public static async Task Main(string[] args)
3838
3939 string toFormat = args . Length > inputFilesEndIndex + 1
4040 ? args [ ^ ( 1 + parametersCount ) ] // Last argument - parameters with '='
41- : Path . GetExtension ( outputFile ) . Trim ( '.' ) . ToLower ( ) ; // Infer from output file
41+ : Path . GetExtension ( outputDirectoryOrFile ) . Trim ( '.' ) . ToLower ( ) ; // Infer from output file
4242
4343 ValidateInputFiles ( inputFiles , fromFormat ) ;
4444
@@ -48,7 +48,11 @@ public static async Task Main(string[] args)
4848 arg => arg . Split ( '=' ) [ 1 ]
4949 ) ;
5050
51- await ConvertFiles ( apiToken , fromFormat , toFormat , inputFiles , outputFile , dynamicProperties ) ;
51+ // Setting file name for simplified (3 parameters) conversion.
52+ if ( args . Length == 3 && dynamicProperties . Keys . All ( x => ! x . Equals ( "FileName" , StringComparison . CurrentCultureIgnoreCase ) ) )
53+ dynamicProperties . Add ( "FileName" , Path . GetFileNameWithoutExtension ( outputDirectoryOrFile ) ) ;
54+
55+ await ConvertFiles ( apiToken , fromFormat , toFormat , inputFiles , outputDirectoryOrFile , dynamicProperties ) ;
5256 }
5357
5458 private static void ValidateInputFiles ( string [ ] inputFiles , string fromFormat )
0 commit comments