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

NoWrappingWrapper removes newlines from help output? #107

Closed
wants to merge 1 commit into from

Conversation

d1
Copy link
Contributor

@d1 d1 commented Sep 27, 2012

Why does the NoWrappingWrapper remove newlines from help output? Thats exactly what I expected it not to do.

I want to be able to include things like tables and CLI usage examples:

long_desc """

Example:
$ app command
=> Does something to the first thing!

$ app command -a
=> Does something to all the things!
"""

Now, even with NoWrappingWrapper, I get an output like this:
$ app help command
Example: $ app command => Does something to the first thing! $ app command -a => Does something to all the things!

Whats the best way to handle this?

Should we create a new DoNothingWrapper that actually doesn't reformat the help text at all? Or should NoWrappingWrapper actually behave this way?

@davetron5000
Copy link
Owner

Damn, you are right. I think my thinking was that it should remove all
formatting, which in retrospect is incredibly unhelpful. I think a
DoNothingWrapper or something along those lines that just passes through
verbatim is the right choice. Sorry about that :(

On Thu, Sep 27, 2012 at 12:31 PM, Dave Strock notifications@git.luolix.topwrote:

Why does the NoWrappingWrapper remove newlines from help output? Thats
exactly what I expected it not to do.

I want to be able to include things like tables and CLI usage examples:

long_desc """

Example:
$ app command
=> Does something to the first thing!

$ app command -a
=> Does something to all the things!
"""

Now, even with NoWrappingWrapper, I get an output like this:
$ app help command
Example: $ app command => Does something to the first thing! $ app command
-a => Does something to all the things!

Whats the best way to handle this?

Should we create a new DoNothingWrapper that actually doesn't reformat the
help text at all? Or should NoWrappingWrapper actually behave this way?


Reply to this email directly or view it on GitHubhttps://github.com//issues/107.

@d1
Copy link
Contributor Author

d1 commented Sep 27, 2012

No worries. Thinking about it now NoWrappingWrapper is really a SingleLineWrapper, or something like that.

Anyway, I won't have time to test until tonight, but is something simple like this commit what you're looking for?

Also, is there still value in the NoWrappingWrapper or should we just replace it with an implementation that actually doesn't wrap at all?

@davetron5000
Copy link
Owner

Yeah, I'd leave the NoWrappingWrapper and probably rename it to SingleLineWrapper, but leave the api call that triggers it the same. No reason to remove it (especically since maybe someone might've actually asked for it), but your approach looks about right to me. I think since it's so simple, we could just make a simple unit test for it, as opposed to a full-blown integration/cucumber test.

davetron5000 added a commit that referenced this pull request Sep 30, 2012
Related to #107, this class is somewhat braindead, but at least
it's now named more appropriately.
@davetron5000
Copy link
Owner

Merged this in, with a slight change to the name (called in "Verbatim", but your help option works, too).

It's up on rubygems as 2.3.0.rc1. Can you give it a try? The one thing I wasn't sure about was that the output is still indented underneath DESCRIPTION by two spaces. This seems OK to me, as it will preserve the formatting, but just indent it. I could also see the case for not doing that, so check it out and see if it looks like how you'd expect. If it does, I'll release it as 2.3.

Thanks!

@d1
Copy link
Contributor Author

d1 commented Oct 2, 2012

Sorry, I got busy this weekend and wasn't able to work on this. Thanks for going ahead with it. I'm going to give it a look right now and get back to you.

Also, I much prefer "verbatim" to "do_nothing". I think that's a good choice.

@d1
Copy link
Contributor Author

d1 commented Oct 2, 2012

OK, I think 2.3.0.rc1 is good enough for now.

Its not exactly what I expected because it actually only indents the first line of the command description (due to the spaces in the ERB template in command_help_format.rb).

So it ends up with something like:

DESCRIPTION
    Only the first line is indented when description text
is more than one line.

It looks slightly weird, but it is totally usable and suits my needs.

Thinking about it now, I think maybe what I want is an IndentOnlyWrapper that just adds the indentation to the beginning of each line. For now, I have no problem indenting manually by just adding a leading column of spaces directly to the long_desc string.

If that becomes a real burden, I'll submit another PR to fix it ;)

@davetron5000
Copy link
Owner

That is weird; for me it seemed to indent each line. Man, who knew
formatting text was so complex :)

On Tue, Oct 2, 2012 at 11:47 AM, Dave Strock notifications@git.luolix.topwrote:

OK, I think 2.3.0.rc1 is good enough for now.

Its not exactly what I expected because it actually only indents the first
line of the command description (due to the spaces in the ERB template in
command_help_format.rb).

So it ends up with something like:

DESCRIPTION
Only the first line is indented when description text
is more than one line.

It looks slightly weird, but it is totally usable and suits my needs.

Thinking about it now, I think maybe what I want is an IndentOnlyWrapperthat just adds the indentation to the beginning of each line. For now, I
have no problem indenting manually by just adding a leading column of
spaces directly to the long_desc string.

If that becomes a real burden, I'll submit another PR to fix it ;)


Reply to this email directly or view it on GitHubhttps://github.com//pull/107#issuecomment-9075684.

@davetron5000
Copy link
Owner

This is up now in 2.3.0. If the indenting is bugging you, I'm up for changing it.

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

Successfully merging this pull request may close these issues.

2 participants