Closed kotfu closed 1 year ago
console.print(parser.format_help())
It seems like you are hitting #54 again. parser.format_help()
produces a text with ansi escape sequences that you are printing with console.print
which treats it as literal text, not as ansi text. It appears that the new %(prog)s
style in your example makes the produced raw ansi text just long enough to exceed the width of your console which in turn wraps it to the second line. Here is the produced ansi text of the usage:
\x1b[38;5;208mUsage:\x1b[0m list \x1b[36m-r\x1b[0m [\x1b[36m-s\x1b[0m \x1b[38;5;36m{running,stopped}\x1b[0m] \x1b[36m[config_name]\x1b[0m\n
\x1b[38;5;208mUsage:\x1b[0m \x1b[38;5;244mlist\x1b[0m \x1b[36m-r\x1b[0m [\x1b[36m-s\x1b[0m \x1b[38;5;36m{running,stopped}\x1b[0m] \x1b[36m[config_name]\x1b[0m\n
As you can see the second one differs from the first only by the new "%(prog)s style" \x1b[38;5;244mlist\x1b[0m
which is the expected behavior. You are just using the wrong tool to display it on the terminal. Again, here are your options to print the output:
After further experimenting, I think I found a bug which was introduced by #56. Consider the following:
In the released 1.0.0 version, the output is:
In the unreleased main branch, the output is: