docopt / docopt.R

Command-line interface description language for R (http://docopt.org)
Other
210 stars 17 forks source link

Using stars as argument #17

Open cysouw opened 8 years ago

cysouw commented 8 years ago

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 '*'