spectre.console
spectre.console copied to clipboard
Settings with multiple arguments out of order in command help text
If you have a settings class with multiple arguments defined as follows:
public class Settings : CommandSettings
{
[CommandArgument(0, "<ID>")]
[Description("New student unique id.")]
public int Id { get; set; }
[CommandArgument(1, "<FIRST-NAME>")]
[Description("New student first name.")]
public string FirstName { get; set; }
[CommandArgument(2, "<LAST-NAME>")]
[Description("New student last name.")]
public string LastName { get; set; }
[CommandOption("-e|--enrollment <DATE>")]
[Description("New student enrollment date.")]
public DateTimeOffset? EnrollmentDate { get; set; }
}
If you look for the command help text using the command line: app student new -h
USAGE:
lesson student new <LAST-NAME> <FIRST-NAME> <ID> [OPTIONS]
EXAMPLES:
lesson student new 1001 Bill Shakespeare --enrollment 5/14/1549
ARGUMENTS:
<ID> New student unique id
<FIRST-NAME> New student first name
<LAST-NAME> New student last name
OPTIONS:
-h, --help Prints help information
-e, --enrollment <DATE> New student enrollment date
The USAGE section has the arguments in reverse order. The ARGUMENTS section order is correct. But if you run the following help command: app student -h:
USAGE:
lesson student [OPTIONS] <COMMAND>
EXAMPLES:
lesson student new 1001 Bill Shakespeare --enrollment 5/14/1549
lesson student view 1001
lesson student list
lesson student delete 1001
OPTIONS:
-h, --help Prints help information
COMMANDS:
new <ID> <FIRST-NAME> <LAST-NAME> Add new student information
view <ID> View student information by id
list View list of students
delete <ID> Remove student from list
Notice that the new COMMAND argument order is correct here.
@DarthPedro Thanks for reporting this. Will take a look once I have some spare time.
Thanks!