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

Using stars as argument

Open cysouw opened this issue 8 years ago • 0 comments

It would be very useful to allow stars as arguments to refer to all files in a directory. Currently there are some hiccups in this docopt variant (and I haven't tested others...). I don't know how much regex-parsing should be provided by docopt, I am ready to accept a 'no' on this request :-).

Basically, the problem is that some arguments give immediate errors, like unquoted stars * or the sequence dot-slash-star ./* . However, stars are accepted in other strings, like foo/*

This simple test script shows the effect:

#!/usr/bin/env Rscript
library(docopt)
doc <- "USAGE: foo ARG"
attach(docopt(doc))
print(sessionInfo())
print(ARG)

try the following. The first works, the others don't.

foo test/*
foo *
foo ./*

It does work when quoted, foo '*'

cysouw avatar May 03 '16 11:05 cysouw