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 seems that docopt completely ignores commandArgs(). I solved my problem by modifying the script. I decided that if the first element of the output of commandArgs() was a special magic word, then the docopt(doc) results should be ignored and the rest of commandArgs() should be parsed instead. Ugly hack, but works for my purpose. If you have better propositions, don't hesitate.
redefining commandArgs() in your global environment won't change which commandArgs function is found by docopt. The symbol commandArgs is resolved in the namespace of the docopt package, not in your global environment.
What you probably want to do is mask the docopt function in your global environment, though it's arguably an anti-pattern and probably a bad idea. In any case, this is how you could do it:
Is it possible to pass arguments to a script using docopt when sourcing this script?
I tried redefining commandArgs as suggested in http://stackoverflow.com/a/14526329/1878788, but this fails.
for instance, my docopt text (named
doc
) contains the following rule:If, in my interactive R session, I redefine
commandArgs
as follows:and then source my script, when I examine the result of
docopt(doc)
, I see the following:Any help appreciated.
The text was updated successfully, but these errors were encountered: