Why are newlines added to the help under python clickCalling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?How can I remove a trailing newline?Does Python have a ternary conditional operator?How to print without newline or space?Does Python have a string 'contains' substring method?Python argparse: How to insert newline in the help text?
How Total raw is calculated for Science pack 2?
Visiting girlfriend in the USA
Would there be balance issues if I allowed opportunity attacks against any creature, not just hostile ones?
Is torque as fundamental a concept as force?
Why are my split equations aligned to right by default?
Which is the best password hashing algorithm in .Net Core?
How Powerful a Starship Coilgun Can We Make?
Using GNU screen, I get raw prompt with backslashes
Is it rude to ask my opponent to resign an online game when they have a lost endgame?
How to check status of Wi-Fi adapter through command line?
Is it safe for a student to give negative feedback in student evaluations?
What is the motivation behind designing a control stick that does not move?
Updating multiple vector points at once with vertex editor in QGIS?
Why did the VIC-II and SID use 6 µm technology in the era of 3 µm and 1.5 µm?
In Toy Story, are toys the only inanimate objects that become alive? And if so, why?
What is the definition of Product
What are the French equivalents of "blow away the cobwebs"?
What is the maximal acceptable delay between pilot's input and flight control surface actuation?
What happens if you just start drawing from the Deck of Many Things without declaring any number of cards?
Why do old games use flashing as means of showing damage?
If the government illegally doesn't ask for article 50 extension, can parliament do it instead?
How does Harry wear the invisibility cloak?
Meaning of "educating the ice"
Why do fuses burn at a specific current?
Why are newlines added to the help under python click
Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?How can I remove a trailing newline?Does Python have a ternary conditional operator?How to print without newline or space?Does Python have a string 'contains' substring method?Python argparse: How to insert newline in the help text?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm using the Click Python library to parse the command line arguments.
Here's a snippet of my code:
@click.group(invoke_without_command=True)
@click.option('--opt', default=1, help='Flag for if we want success or failuren0 = failuren1 = success')
@click.pass_context
When I run my program, for some reason, there's an extra newline between the hyphen and the word "success". Can anyone tell me why there's a newline added? I didn't add a newline there. The new line is after both of the words "failure", which is correct. However, there should be one after the word success, but for some reason, it comes before the word success.
$ ./get_last_successful_build.py --help
Usage: get_last_successful_build.py [OPTIONS] COMMAND [ARGS]...
Options:
--opt INTEGER Flag for if we want success or failure
0 - failure
1 -
success
--help Show this message and exit.
python
add a comment |
I'm using the Click Python library to parse the command line arguments.
Here's a snippet of my code:
@click.group(invoke_without_command=True)
@click.option('--opt', default=1, help='Flag for if we want success or failuren0 = failuren1 = success')
@click.pass_context
When I run my program, for some reason, there's an extra newline between the hyphen and the word "success". Can anyone tell me why there's a newline added? I didn't add a newline there. The new line is after both of the words "failure", which is correct. However, there should be one after the word success, but for some reason, it comes before the word success.
$ ./get_last_successful_build.py --help
Usage: get_last_successful_build.py [OPTIONS] COMMAND [ARGS]...
Options:
--opt INTEGER Flag for if we want success or failure
0 - failure
1 -
success
--help Show this message and exit.
python
add a comment |
I'm using the Click Python library to parse the command line arguments.
Here's a snippet of my code:
@click.group(invoke_without_command=True)
@click.option('--opt', default=1, help='Flag for if we want success or failuren0 = failuren1 = success')
@click.pass_context
When I run my program, for some reason, there's an extra newline between the hyphen and the word "success". Can anyone tell me why there's a newline added? I didn't add a newline there. The new line is after both of the words "failure", which is correct. However, there should be one after the word success, but for some reason, it comes before the word success.
$ ./get_last_successful_build.py --help
Usage: get_last_successful_build.py [OPTIONS] COMMAND [ARGS]...
Options:
--opt INTEGER Flag for if we want success or failure
0 - failure
1 -
success
--help Show this message and exit.
python
I'm using the Click Python library to parse the command line arguments.
Here's a snippet of my code:
@click.group(invoke_without_command=True)
@click.option('--opt', default=1, help='Flag for if we want success or failuren0 = failuren1 = success')
@click.pass_context
When I run my program, for some reason, there's an extra newline between the hyphen and the word "success". Can anyone tell me why there's a newline added? I didn't add a newline there. The new line is after both of the words "failure", which is correct. However, there should be one after the word success, but for some reason, it comes before the word success.
$ ./get_last_successful_build.py --help
Usage: get_last_successful_build.py [OPTIONS] COMMAND [ARGS]...
Options:
--opt INTEGER Flag for if we want success or failure
0 - failure
1 -
success
--help Show this message and exit.
python
python
edited Mar 28 at 2:21
Chris
65.4k18 gold badges134 silver badges130 bronze badges
65.4k18 gold badges134 silver badges130 bronze badges
asked Mar 28 at 1:54
ClassifiedClassified
2,29213 gold badges48 silver badges75 bronze badges
2,29213 gold badges48 silver badges75 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I think Click is wrapping your paragraph based on the width of the terminal but not factoring in newlines:
The default behavior of Click is to rewrap text based on the width of the terminal. In some circumstances, this can become a problem. The main issue is when showing code examples, where newlines are significant.
If you take the whole help string, with the padding that Click itself adds, and remove all newlines, the word success ends at character position 81:
--opt INTEGER Flag for if we want success or failure 0 - failure 1 - success
123456789012345678901234567890123456789012345678901234567890123456789012345678901
1 2 3 4 5 6 7 8
If the newlines themselves are included in its calculation that brings us to 83. I'm not sure how wide your terminal is, but 80 columns is a common width.
See if you can override this with b (wrapped for readability):
@click.option(
'--opt',
default=1,
help='bnFlag for if we want success or failuren0 = failuren1 = success'
)
Rewrapping can be disabled on a per-paragraph basis by adding a line with solely the
bescape marker in it. This line will be removed from the help text and rewrapping will be disabled.
Well, this sounds reasonable but it is a little bit strange as why there is stillnafter "failure" and before "0"? Or ifnwon't influence howclickrecognize lines, addingbmight remove the whole help text.
– Sraw
Mar 28 at 3:00
@Sraw, I'm not sure exactly how this works, but I think your inlinenvalues are rendered but not considered when Click adds its own newlines. Give it a try and see what happens.
– Chris
Mar 28 at 3:06
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389049%2fwhy-are-newlines-added-to-the-help-under-python-click%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think Click is wrapping your paragraph based on the width of the terminal but not factoring in newlines:
The default behavior of Click is to rewrap text based on the width of the terminal. In some circumstances, this can become a problem. The main issue is when showing code examples, where newlines are significant.
If you take the whole help string, with the padding that Click itself adds, and remove all newlines, the word success ends at character position 81:
--opt INTEGER Flag for if we want success or failure 0 - failure 1 - success
123456789012345678901234567890123456789012345678901234567890123456789012345678901
1 2 3 4 5 6 7 8
If the newlines themselves are included in its calculation that brings us to 83. I'm not sure how wide your terminal is, but 80 columns is a common width.
See if you can override this with b (wrapped for readability):
@click.option(
'--opt',
default=1,
help='bnFlag for if we want success or failuren0 = failuren1 = success'
)
Rewrapping can be disabled on a per-paragraph basis by adding a line with solely the
bescape marker in it. This line will be removed from the help text and rewrapping will be disabled.
Well, this sounds reasonable but it is a little bit strange as why there is stillnafter "failure" and before "0"? Or ifnwon't influence howclickrecognize lines, addingbmight remove the whole help text.
– Sraw
Mar 28 at 3:00
@Sraw, I'm not sure exactly how this works, but I think your inlinenvalues are rendered but not considered when Click adds its own newlines. Give it a try and see what happens.
– Chris
Mar 28 at 3:06
add a comment |
I think Click is wrapping your paragraph based on the width of the terminal but not factoring in newlines:
The default behavior of Click is to rewrap text based on the width of the terminal. In some circumstances, this can become a problem. The main issue is when showing code examples, where newlines are significant.
If you take the whole help string, with the padding that Click itself adds, and remove all newlines, the word success ends at character position 81:
--opt INTEGER Flag for if we want success or failure 0 - failure 1 - success
123456789012345678901234567890123456789012345678901234567890123456789012345678901
1 2 3 4 5 6 7 8
If the newlines themselves are included in its calculation that brings us to 83. I'm not sure how wide your terminal is, but 80 columns is a common width.
See if you can override this with b (wrapped for readability):
@click.option(
'--opt',
default=1,
help='bnFlag for if we want success or failuren0 = failuren1 = success'
)
Rewrapping can be disabled on a per-paragraph basis by adding a line with solely the
bescape marker in it. This line will be removed from the help text and rewrapping will be disabled.
Well, this sounds reasonable but it is a little bit strange as why there is stillnafter "failure" and before "0"? Or ifnwon't influence howclickrecognize lines, addingbmight remove the whole help text.
– Sraw
Mar 28 at 3:00
@Sraw, I'm not sure exactly how this works, but I think your inlinenvalues are rendered but not considered when Click adds its own newlines. Give it a try and see what happens.
– Chris
Mar 28 at 3:06
add a comment |
I think Click is wrapping your paragraph based on the width of the terminal but not factoring in newlines:
The default behavior of Click is to rewrap text based on the width of the terminal. In some circumstances, this can become a problem. The main issue is when showing code examples, where newlines are significant.
If you take the whole help string, with the padding that Click itself adds, and remove all newlines, the word success ends at character position 81:
--opt INTEGER Flag for if we want success or failure 0 - failure 1 - success
123456789012345678901234567890123456789012345678901234567890123456789012345678901
1 2 3 4 5 6 7 8
If the newlines themselves are included in its calculation that brings us to 83. I'm not sure how wide your terminal is, but 80 columns is a common width.
See if you can override this with b (wrapped for readability):
@click.option(
'--opt',
default=1,
help='bnFlag for if we want success or failuren0 = failuren1 = success'
)
Rewrapping can be disabled on a per-paragraph basis by adding a line with solely the
bescape marker in it. This line will be removed from the help text and rewrapping will be disabled.
I think Click is wrapping your paragraph based on the width of the terminal but not factoring in newlines:
The default behavior of Click is to rewrap text based on the width of the terminal. In some circumstances, this can become a problem. The main issue is when showing code examples, where newlines are significant.
If you take the whole help string, with the padding that Click itself adds, and remove all newlines, the word success ends at character position 81:
--opt INTEGER Flag for if we want success or failure 0 - failure 1 - success
123456789012345678901234567890123456789012345678901234567890123456789012345678901
1 2 3 4 5 6 7 8
If the newlines themselves are included in its calculation that brings us to 83. I'm not sure how wide your terminal is, but 80 columns is a common width.
See if you can override this with b (wrapped for readability):
@click.option(
'--opt',
default=1,
help='bnFlag for if we want success or failuren0 = failuren1 = success'
)
Rewrapping can be disabled on a per-paragraph basis by adding a line with solely the
bescape marker in it. This line will be removed from the help text and rewrapping will be disabled.
edited Mar 28 at 12:31
answered Mar 28 at 2:07
ChrisChris
65.4k18 gold badges134 silver badges130 bronze badges
65.4k18 gold badges134 silver badges130 bronze badges
Well, this sounds reasonable but it is a little bit strange as why there is stillnafter "failure" and before "0"? Or ifnwon't influence howclickrecognize lines, addingbmight remove the whole help text.
– Sraw
Mar 28 at 3:00
@Sraw, I'm not sure exactly how this works, but I think your inlinenvalues are rendered but not considered when Click adds its own newlines. Give it a try and see what happens.
– Chris
Mar 28 at 3:06
add a comment |
Well, this sounds reasonable but it is a little bit strange as why there is stillnafter "failure" and before "0"? Or ifnwon't influence howclickrecognize lines, addingbmight remove the whole help text.
– Sraw
Mar 28 at 3:00
@Sraw, I'm not sure exactly how this works, but I think your inlinenvalues are rendered but not considered when Click adds its own newlines. Give it a try and see what happens.
– Chris
Mar 28 at 3:06
Well, this sounds reasonable but it is a little bit strange as why there is still
n after "failure" and before "0"? Or if n won't influence how click recognize lines, adding b might remove the whole help text.– Sraw
Mar 28 at 3:00
Well, this sounds reasonable but it is a little bit strange as why there is still
n after "failure" and before "0"? Or if n won't influence how click recognize lines, adding b might remove the whole help text.– Sraw
Mar 28 at 3:00
@Sraw, I'm not sure exactly how this works, but I think your inline
n values are rendered but not considered when Click adds its own newlines. Give it a try and see what happens.– Chris
Mar 28 at 3:06
@Sraw, I'm not sure exactly how this works, but I think your inline
n values are rendered but not considered when Click adds its own newlines. Give it a try and see what happens.– Chris
Mar 28 at 3:06
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389049%2fwhy-are-newlines-added-to-the-help-under-python-click%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown