argparse
argparse copied to clipboard
Bugfix/Escape CSI sequences correctly
I could not use the library on my Linux machine until I escaped the CSI sequences correctly:
\e -> \\e
This PR should fix it for any unixoid system.
Hi lightr4in, thanks for reporting this. However, this does not seem to work on any of the machines I've tested it on (Ubuntu 20.04/22.04, gnome terminal), and instead of making the text bold, it adds additional escape characters to the prompt. E.g.:
argparse_test source_path destination -k=5 --alpha=1 --beta 3.3 --gamma --numbers=1,2,3,4,5 --numbers2 6,7,8 --files f1 f2 f3 --custom hello_custom --optional 1 --verbose
arg_0(Source ...) : \e[1msource_path\e[0m
arg_1(Destina...) : \e[1mdestination\e[0m
arg_2(Others) : unknown
-k : \e[1m5\e[0m
-a,--alpha : \e[1m1\e[0m
-b,--beta : \e[1m3.3\e[0m
--beta2 : 0.6f
-g,--gamma : \e[1m0.5\e[0m
-c,--custom : \e[1mhello_custom\e[0m
-n,--numbers : \e[1m1,2,3,4,5\e[0m
--numbers2 : \e[1m6,7,8\e[0m
--files : \e[1mf1,f2,f3\e[0m
-o,--optional : \e[1m1\e[0m
-f,--flag : false
-v,--verbose : \e[1mtrue\e[0m
--help : false
Can you explain a bit more about what OS are you using, and what terminal?