docopt.R icon indicating copy to clipboard operation
docopt.R copied to clipboard

docopt.R mixes options and arguments

Open antonkulaga opened this issue 4 years ago • 0 comments

I have the following program:

doc <- 'Usage:
  translate.R [--wd <wd>][--suffix <suffix>] <dbs> ...

  Options:   
   -w --wd <wd> [default: FALSE]
   -s --suffix <suffix> [default: translated].
   -h --help     Show this screen.'

when I call:

    args <- c('_with_translation''/data/samples/AIRR-Seq/ramos/test/merged/heavy.tsv''/data/samples/AIRR-Seq/ramos/test/merged/light.tsv'
docopt(doc, args = args, version="0.1")
)

sometimes it works, sometimes "_with_translation" becomes part of dbs. However, when I want to popular --wd argument all the order is messed up and TRUE goes to suffix while '_with_translation' becomes part of

    args <- c(TRUE, '_with_translation''/data/samples/AIRR-Seq/ramos/test/merged/heavy.tsv''/data/samples/AIRR-Seq/ramos/test/merged/light.tsv'
docopt(doc, args = args, version="0.1")

It would be nice if you would fix this bug and also provide a clear way (or clear explanations in the docs) how I can pass options in docopt together with multiple arguments in a safe and reliable way.

antonkulaga avatar Mar 30 '21 12:03 antonkulaga