// Copyright Epic Games, Inc. All Rights Reserved. using System; namespace EpicGames.Core { /// /// Attribute to indicate the name of a command line argument /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] public sealed class CommandLineAttribute : Attribute { /// /// Prefix for the option, with a leading '-' and trailing '=' character if a value is expected. /// #pragma warning disable CA1019 // Define accessors for attribute arguments public string? Prefix { get; set; } #pragma warning restore CA1019 // Define accessors for attribute arguments /// /// Specifies a fixed value for this argument. Specifying an alternate value is not permitted. /// public string? Value { get; set; } = null; /// /// Whether this argument is required /// public bool Required { get; set; } /// /// Whether this argument is required /// public bool MarkUsed { get; set; } = true; /// /// Accepts positional arguments (ie. without a preceding hyphen) /// public bool Positional { get; set; } /// /// For collection types, specifies the separator character between multiple arguments /// public char ListSeparator { get; set; } = '\0'; /// /// Description of the operation. /// public string? Description { get; set; } /// /// Constructor /// /// Prefix for this argument public CommandLineAttribute(string? prefix = null) { Prefix = prefix; if(prefix != null) { if(!prefix.StartsWith('-')) { throw new Exception("Command-line arguments must begin with a '-' character"); } } } } }