split CLI modes to separate files

This commit is contained in:
2025-04-06 13:53:21 +05:00
parent eeb8f43d3d
commit 3c1d195849
5 changed files with 85 additions and 71 deletions
+21 -17
View File
@@ -14,26 +14,26 @@ try
string? searchQuery = null;
new LaunchArgumentParser(
new LaunchArgument(["-i", "--input"],
"Set input file path",
s => inputPath = s,
"gamestate or zip file"),
new LaunchArgument(["-i", "--input"],
"Set input file path",
s => inputPath = s,
"gamestate or zip file"),
new LaunchArgument(["-o", "--output"],
"Set output file path",
s => outputPath = s,
"json file [default=stdout]"),
new LaunchArgument(["-o", "--output"],
"Set output file path",
s => outputPath = s,
"json file [default=stdout]"),
new LaunchArgument(["-s", "--search"],
"Search in input file",
s =>
{
searchQuery = s;
mode = Mode.Search;
},
"search expression")
new LaunchArgument(["-s", "--search"],
"Search in input file",
s =>
{
searchQuery = s;
mode = Mode.Search;
},
"search expression")
)
.WithNoExit()
.AllowNoArguments()
.ParseAndHandle(args);
if (args.Length == 0)
@@ -57,6 +57,10 @@ try
break;
}
}
catch (LaunchArgumentParser.ExitAfterHelpException)
{
// this exception is throwed after -h argument to close the program
}
catch (Exception ex)
{
ColoredConsole.WriteLine(ex.ToStringDemystified(), ConsoleColor.Red);