Hello @Dani_S ,
I see you've put in solid effort implementing the feedback. There are a few things that need adjustment before this is ready though.
The main method issue
Your Main method currently looks like this:
private static void Main(string[] args)
{
// ... license check ...
Environment.Exit(Run(args));
}
This conflicts with what your own readme says about testing. Calling Environment.Exit here will kill the test runner. Change it to:
private static int Main(string[] args)
{
if (! AsposeLicenseManager.ApplyLicense())
{
Console.Error.WriteLine("⚠️ Failed to apply Aspose license.");
return (int)ExitCode.AppError;
}
Console. OutputEncoding = System.Text. Encoding.UTF8;
args = EnsureDebugArgs(args);
return Run(args);
}
The argument repair logic
TryRepairUnquotedInputArgs tries to fix paths with spaces that weren't quoted. Most cli tools just require proper quoting and throw clear errors when paths are malformed. Consider validating early instead:
if (! File.Exists(inputPath) && !Directory.Exists(inputPath))
{
Console.WriteLine($"❌ Input path not found: {inputPath}");
Console.WriteLine("Note: Wrap paths containing spaces in quotes");
return (int)ExitCode.AppError;
}
Magic numbers
You have if (args.Length < 6) and GetOptionalLogArguments(args, 5) scattered throughout. Use named constants so the code documents itself:
private const int MIN_REQUIRED_ARGS = 5;
private const int LOG_ARGS_START_INDEX = 5;
The single command switch
Your Run method has a switch statement with only one case (gis_convert). Since you only support one command, a simple equality check is clearer:
if (! args[0]. Equals("gis_convert", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine($"❌ Unknown command: {args[0]}\n");
ShowHelp();
return (int)ExitCode.AppError;
}
return RunGisConverter(args);