use ExitCode instead of Exit and add missing one at SetFunction

This commit is contained in:
Syping 2025-11-20 04:37:24 +01:00
parent de049c535b
commit 530c84d979

View file

@ -309,13 +309,13 @@ internal static class Commands {
Command createCommand = new("create", "Create Photo") { Command createCommand = new("create", "Create Photo") {
formatArgument, jpegOption, descriptionOption, jsonOption, titleOption, outputOption formatArgument, jpegOption, descriptionOption, jsonOption, titleOption, outputOption
}; };
createCommand.SetAction(result => Environment.Exit(CreateFunction( createCommand.SetAction(result => Environment.ExitCode = CreateFunction(
result.GetRequiredValue(formatArgument), result.GetRequiredValue(formatArgument),
result.GetValue(jpegOption), result.GetValue(jpegOption),
result.GetValue(descriptionOption), result.GetValue(descriptionOption),
result.GetValue(jsonOption), result.GetValue(jsonOption),
result.GetValue(titleOption), result.GetValue(titleOption),
result.GetRequiredValue(outputOption)))); result.GetRequiredValue(outputOption)));
return createCommand; return createCommand;
} }
} }
@ -355,10 +355,10 @@ internal static class Commands {
Command getCommand = new("get", "Get Photo Data") { Command getCommand = new("get", "Get Photo Data") {
inputArgument, dataTypeArgument, outputOption inputArgument, dataTypeArgument, outputOption
}; };
getCommand.SetAction(result => Environment.Exit(GetFunction( getCommand.SetAction(result => Environment.ExitCode = GetFunction(
result.GetRequiredValue(inputArgument), result.GetRequiredValue(inputArgument),
result.GetRequiredValue(dataTypeArgument), result.GetRequiredValue(dataTypeArgument),
result.GetRequiredValue(outputOption)))); result.GetRequiredValue(outputOption)));
return getCommand; return getCommand;
} }
} }
@ -392,7 +392,7 @@ internal static class Commands {
Command setCommand = new("set", "Set Photo Data") { Command setCommand = new("set", "Set Photo Data") {
inputArgument, formatOption, jpegOption, descriptionOption, jsonOption, titleOption, updateSignOption, outputOption inputArgument, formatOption, jpegOption, descriptionOption, jsonOption, titleOption, updateSignOption, outputOption
}; };
setCommand.SetAction(result => SetFunction( setCommand.SetAction(result => Environment.ExitCode = SetFunction(
result.GetRequiredValue(inputArgument), result.GetRequiredValue(inputArgument),
result.GetValue(formatOption), result.GetValue(formatOption),
result.GetValue(jpegOption), result.GetValue(jpegOption),
@ -417,8 +417,8 @@ internal static class Commands {
commandArgument commandArgument
}; };
pathCommand.Hidden = true; pathCommand.Hidden = true;
pathCommand.SetAction(result => Environment.Exit(PathFunction( pathCommand.SetAction(result => Environment.ExitCode = PathFunction(
result.GetRequiredValue(commandArgument)))); result.GetRequiredValue(commandArgument)));
return pathCommand; return pathCommand;
} }
} }