You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be very neat if docopt::docopt parsing of the "doc"( "help") string would allow for formating using ANSI control sequences. docopt seems to be confused when it matches the square ( [ and ] ) parentheses around the expected "Usage" and "Options" patterns.
This works fine (giving me a boldface and underlined header when I issue ./test.R --help in the command ubuntu command prompt):
`
#!/usr/bin/env Rscript
"
\033[1;4mTest ANSI in R scripts using docopt.\033[0m
Usage:
test.R [--par=PAR]
test.R -h | --help
Options:
--par=PAR The parameter.
-h --help Show help.
" -> doc
However, now I would like to boldface, say, both "Usage:" and "Options:" like this:
`
#!/usr/bin/env Rscript
"
\033[1;4mTest ANSI in R scripts using docopt.\033[0m
\033[1m
Usage:
\033[0m
test.R [--par=PAR]
test.R -h | --help
\033[1m
Options:
\033[0m
--par=PAR The parameter.
-h --help Show help.
" -> doc
Then I get the error Unmatched [ (from docopt parsing)
It works fine when only either "Usage:" or "Options:" are embedded in ANSI.
The text was updated successfully, but these errors were encountered:
madsheilskov
changed the title
ANSCI control sequences not compatible with docopt parsing
ANSI control sequences not compatible with docopt parsing
Jun 29, 2021
It would be very neat if
docopt::docopt
parsing of the "doc"( "help") string would allow for formating using ANSI control sequences. docopt seems to be confused when it matches the square ([
and]
) parentheses around the expected "Usage" and "Options" patterns.This works fine (giving me a boldface and underlined header when I issue
./test.R --help
in the command ubuntu command prompt):`
#!/usr/bin/env Rscript
"
\033[1;4mTest ANSI in R scripts using docopt.\033[0m
Usage:
test.R [--par=PAR]
test.R -h | --help
Options:
--par=PAR The parameter.
-h --help Show help.
" -> doc
suppressWarnings(suppressMessages(require(docopt)))
opt <- docopt(doc)
`
However, now I would like to boldface, say, both "Usage:" and "Options:" like this:
`
#!/usr/bin/env Rscript
"
\033[1;4mTest ANSI in R scripts using docopt.\033[0m
\033[1m
Usage:
\033[0m
test.R [--par=PAR]
test.R -h | --help
\033[1m
Options:
\033[0m
--par=PAR The parameter.
-h --help Show help.
" -> doc
suppressWarnings(suppressMessages(require(docopt)))
opt <- docopt(doc)
`
Then I get the error
Unmatched [
(fromdocopt
parsing)It works fine when only either "Usage:" or "Options:" are embedded in ANSI.
The text was updated successfully, but these errors were encountered: