Incorrect usage information in the help output
Hi,
Is there a problem with the help "Usage:" output (I am using version 2.0.0-beta1.21308.1)? The help says that the options must be set before the command. When I do that, an "Unrecognized command or argument" error is displayed. If I set the option after the command, it works.
> rstdoctool osa -?
osa
Creates an open source acknowledgement document
Usage:
**rstdoctool [options] osa < file >...**
Arguments:
<file> Path to a XML description file
Options:
-v, --verbose Displays detailed output and warning messages
-?, -h, --help Show help and usage information
> rstdoctool **-v** osa d:\test.xml # (not working)
> rstdoctool osa **-v** d:\test.xml # (working)
Unrecognized command or argument '-v'
osa
Creates an open source acknowledgement document
Usage:
rstdoctool [options] osa < file >... =====> **rstdoctool osa [options] < file >...**
Arguments:
<file> Path to a XML description file
Options:
-v, --verbose Displays detailed output and warning messages
-?, -h, --help Show help and usage information
Another question. In an older version it was possible to change the titles in the help as follows. How do I do that with the new version?
System.CommandLine.Help.DefaultHelpText.Usage.Title = "SYNOPSIS"; System.CommandLine.Help.DefaultHelpText.Arguments.Title = "ARGUMENTS"; System.CommandLine.Help.DefaultHelpText.Options.Title = "OPTIONS"; System.CommandLine.Help.DefaultHelpText.Commands.Title = "COMMANDS";
Thank you Ralph
I updated your comment a little for readability.
The help output does look a bit off. This is being partially addressed by #1335, I think.
Have the same issue with the Usage output.
Showing:
test [options] [command]
Should be:
test [command] [options]
the Help_layout_has_not_changed test seems to show this ordering:
Description:
Test description
Usage:
the-root-command <the-root-arg-no-description-no-default> [<the-root-arg-no-description-default> <the-root-arg-no-default> [<the-root-arg> [<the-root-arg-enum-default>]]] [options]
Arguments:
<the-root-arg-no-description-no-default>
<the-root-arg-no-description-default> [default: the-root-arg-no-description-default-value]
<the-root-arg-no-default> the-root-arg-no-default-description
<the-root-arg> the-root-arg-description [default: the-root-arg-one-value]
<Read|ReadWrite|Write> the-root-arg-enum-default-description [default: Read]
Options:
-trna, --the-root-option-no-arg (REQUIRED) the-root-option-no-arg-description
-trondda, --the-root-option-no-description-default-arg <the-root-option-no-description-default-arg> [default: the-root-option--no-description-default-arg-value]
-tronda, --the-root-option-no-default-arg <the-root-option-arg-no-default-arg> (REQUIRED) the-root-option-no-default-description
-troda, --the-root-option-default-arg <the-root-option-arg> the-root-option-default-arg-description [default: the-root-option-arg-value]
-troea, --the-root-option-enum-arg <Read|ReadWrite|Write> the-root-option-description [default: Read]
-trorea, --the-root-option-required-enum-arg <Read|ReadWrite|Write> (REQUIRED) the-root-option-description [default: Read]
-tromld, --the-root-option-multi-line-description the-root-option
multi-line
description
The [options] part is after all of the arguments. That's what I expect to see here.
Given this parser:
var command = new RootCommand
{
new Option<string>("-s", "An option"),
new Argument<int>("arg", "An argument"),
new Command("subcommand", "A subcommand")
};
The following is the current help output:
Description:
Usage:
Microsoft.DotNet.Interactive.App <arg> [command] [options]
Arguments:
<arg> An argument
Options:
-s <s> An option
--version Show version information
-?, -h, --help Show help and usage information
Commands:
subcommand A subcommand
So I think the ordering of the [command] and [options] portion of the synopsis is correct, but <arg> should be moved to the end of the synopsis.
Does that sound correct? Other changes?