From 530c84d97927f0f47dfbb05aeec05cbe7e248c60 Mon Sep 17 00:00:00 2001 From: Syping Date: Thu, 20 Nov 2025 04:37:24 +0100 Subject: [PATCH] use ExitCode instead of Exit and add missing one at SetFunction --- Commands.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Commands.cs b/Commands.cs index 2d76f42..4953db1 100644 --- a/Commands.cs +++ b/Commands.cs @@ -309,13 +309,13 @@ internal static class Commands { Command createCommand = new("create", "Create Photo") { formatArgument, jpegOption, descriptionOption, jsonOption, titleOption, outputOption }; - createCommand.SetAction(result => Environment.Exit(CreateFunction( + createCommand.SetAction(result => Environment.ExitCode = CreateFunction( result.GetRequiredValue(formatArgument), result.GetValue(jpegOption), result.GetValue(descriptionOption), result.GetValue(jsonOption), result.GetValue(titleOption), - result.GetRequiredValue(outputOption)))); + result.GetRequiredValue(outputOption))); return createCommand; } } @@ -355,10 +355,10 @@ internal static class Commands { Command getCommand = new("get", "Get Photo Data") { inputArgument, dataTypeArgument, outputOption }; - getCommand.SetAction(result => Environment.Exit(GetFunction( + getCommand.SetAction(result => Environment.ExitCode = GetFunction( result.GetRequiredValue(inputArgument), result.GetRequiredValue(dataTypeArgument), - result.GetRequiredValue(outputOption)))); + result.GetRequiredValue(outputOption))); return getCommand; } } @@ -392,7 +392,7 @@ internal static class Commands { Command setCommand = new("set", "Set Photo Data") { inputArgument, formatOption, jpegOption, descriptionOption, jsonOption, titleOption, updateSignOption, outputOption }; - setCommand.SetAction(result => SetFunction( + setCommand.SetAction(result => Environment.ExitCode = SetFunction( result.GetRequiredValue(inputArgument), result.GetValue(formatOption), result.GetValue(jpegOption), @@ -417,8 +417,8 @@ internal static class Commands { commandArgument }; pathCommand.Hidden = true; - pathCommand.SetAction(result => Environment.Exit(PathFunction( - result.GetRequiredValue(commandArgument)))); + pathCommand.SetAction(result => Environment.ExitCode = PathFunction( + result.GetRequiredValue(commandArgument))); return pathCommand; } }