I was writing an R script to plot the ATACseq fragment length distribution and wanted to turn the R script to a command line utility.
I then (re)discovered this awesome docopt.R. One just needs to write the help message the you want to display and docopt() will parse the options, arguments and return a named list which can be accessed inside the R script. check http://docopt.org/
for more information as well.