-
Notifications
You must be signed in to change notification settings - Fork 36
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
Help command improvements #1541
Conversation
The first line of each command's help message was being tabulated four characters in from the left margin, whereas the remaining lines were all tabulated two characters in.
command1 = new MockCommandPlugin("command1", "Command #1 description.", "command-usage", "Command #1 help."); | ||
command2 = new MockCommandPlugin("command2", "Command #2 description.", "command-usage", "Command #2 help."); | ||
command1 = new MockCommandPlugin("command1", "Command #1 description.", "command-usage", " Command #1 help."); | ||
command2 = new MockCommandPlugin("command2", "Command #2 description.", "command-usage", " Command #2 help."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for this extra whitespace in the command help message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to emulate JSAP which tabulates it's help message by two characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the whitespace not be in the validation step for tests rather than the configuration of the mock commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @andyberry88, I don't understand the question. Can you explain it differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell these lines are configuring mock commands that are added to the model so they can be used in tests. The third argument sets the command's help message text, instead of having a mock command object with a fixed help message. So this test is now not simulating the behaviour of a real commands help message format since the help message itself has extra whitespace rather than a utility that outputs them to the console adding the extra whitespace.
@andyberry88, f995a50 makes things worse than how I had them in the first place. If I'd updated the JavaDoc for
where this is the paragraph I've added:
whereas for your commit we'd need this instead:
|
Sorry @thecapdan, my mistake, I meant to move this back to |
I've changed the help command so it correctly indents each line by at least 2 characters. We can't make any assumptions about the rest of the line. Some commands will want to output a tabbed help message where every other line is a longer description of an argument and is indented slightly more. Some commands might not want to do this and may just want all lines to be indented equally. We should only add 2 |
Okay, this is now somewhat of an improvement over my original commit since help commands are no longer required to indent their first line specifically for a terminal (precluding the display of the help message elsewhere), but they are still required to perform terminal specific internal indentation because we don't provide a mechanism for commands to emit tab characters that are then converted in a sensible way depending on where the message is being displayed. Again, I'm not bothered by this because the only place we currently display messages is within the terminal, and we have access to the source code for every command plug-in ever written should we want to change this in the future. |
No description provided.