using System.Collections.Generic; using LibAC.NBT.API; namespace LibAC.Arguments; public static class ArgumentHelpers { /// /// Generates a command-line help message for the provided arguments. /// /// The list of arguments to generate help for. /// A string containing the help message. public static string GenerateHelpMessage(List arguments, string ProgramName) { StringBuilder helpMessage = new StringBuilder(); helpMessage.Append($"Usage: {ProgramName} [options]\n"); foreach (var arg in arguments) { string description = GetArgumentDescription(arg); string valueType = arg.GetValueType().ToString(); helpMessage.Append($" --{arg.Key} [{valueType}] {description}\n"); } return helpMessage.ToString(); } /// /// Gets a description for an argument. This can be extended to provide more info. /// /// The argument for which to generate a description. /// A description of the argument. private static string GetArgumentDescription(IArgument argument) { // You can extend this to add more detailed descriptions for specific arguments return argument.HasValue() ? "Assigned value: " + argument.GetValue() : "No value assigned"; } /// /// Retrieves the type of an argument in a human-readable format. /// /// The argument to get the type for. /// A string describing the argument type. private static string GetArgumentType(IArgument argument) { return argument.GetValueType() switch { ArgumentType.String => "string", ArgumentType.Integer => "integer", ArgumentType.Boolean => "boolean", ArgumentType.Float => "float", ArgumentType.Double => "double", _ => "unknown" }; } }