Documentation about template-strings #270
OskarKlintrot
started this conversation in
General
Replies: 1 comment 12 replies
-
|
@OskarKlintrot Excellent question. I'm a bit behind on documenting Spectre.Console.Cli, but to summarize:
public class ConsoleSettings : CommandSettings
{
[CommandArgument(0, "<MANDATORY>")]
[Description("Mandatory argument")]
public string Mandatory { get; set; } = string.Empty;
[CommandArgument(1, "[OPTIONAL]")]
[Description("Optional argument")]
public string? Optional { get; set; }
[CommandOption("--command-option-flag")]
[Description("Command option flag.")]
public bool CommandOptionFlag { get; set; }
[CommandOption("--command-option-value|-c1|--command-req <REQUIRED_VALUE>")]
[Description("Command option value (required).")]
public string? CommandOptionValue { get; set; }
[CommandOption("--command-option-value-opt|-c2|--command-opt [OPTIONAL_VALUE]")]
[Description("Command option value (optional).")]
public FlagValue<string> CommandOptionValueOptional { get; set; }
} |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any documentation about the template for
CommandArgumentAttributeetc? The hint just saysThe argument template.but I have no clue what that means. Does the[]or<>actually mean/do anything? What else can we use? I guess you can figure it out by reading the source code for TemplateTokenizer but a more convenient way would be appreciated :)Beta Was this translation helpful? Give feedback.
All reactions