Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commandline/src/CommandLine/Text/HelpText.cs AddLine() calls value.Trim() stripping out example spacing #236

Open
tomlm opened this issue Feb 5, 2018 · 3 comments

Comments

@tomlm
Copy link

tomlm commented Feb 5, 2018

In generating help text spacing is supposed to be prefixed to the start of the line to make Usage sections easier to read.

AddLine() calls .Trim() which removes spacing from the start of the line. Since whitespace is used for formatting it should not be calling Trim()

@tomlm
Copy link
Author

tomlm commented Feb 5, 2018

Perhaps replace with:
int iSpace = 0;
while(Char.IsWhiteSpace(value[iSpace]))
builder.append(value[iSpace++]);
value = value.Substring(iSpace);
to preserve leading whitespace?

dwaynenickels pushed a commit to dwaynenickels/commandline that referenced this issue Feb 15, 2018
… and help text formatting (commandlineparser#236) bugs.

-----
1. Added ignoreValueCase param to methods in InstanceChooser.cs.  Passed this arg through call stack.
2. Modified Parser.cs to use settings.CaseInsensitiveEnumValues.
3. Added NewLine before UsageHeadingText in HelpText.cs.
4. Commented-out Trim method call in HelpText.cs.
@ericnewton76
Copy link
Member

@nemec et al, it seems like we should come up with a formal specification about how the help text renders by default. Otherwise I think other's preferences will start leaking into tests and additional PRs like #280. I personally don't mind the changes that #280 makes but I can see it going back and forth, tabs/spaces etc. (ugh, worried about the upcoming flame war just mentioning that)

@nemec
Copy link
Contributor

nemec commented May 12, 2018

I'm okay with #280 as well, considering that indent is hardcoded and was accidentally getting thrown away.

I also agree that commandline should be the one to determine spacing in the help generation based on some defined format. We may want to add a Trim() around the FormatCommandLine call so that extra spaces added by the developer in their own examples/descriptions won't throw off our indenting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants