Commit 6cb89686 authored by Lena Hersemann's avatar Lena Hersemann

the help is now only shown if specifically requested and if the script uses...

the help is now only shown if specifically requested and if the script uses argparser or docopt for handling of additional parameters
parent 35fd9649
......@@ -66,12 +66,18 @@ if(!file.exists(r_script)){
}
## show help if no script parameter is provided or if --help was set
if (identical(scriptArgs, character(0)) || scriptArgs == "--help") {
# show help if --help or -h are set and if the script requires arguments/allows optinal arguments with argparser and docopt
if (!identical(scriptArgs, character(0)) && scriptArgs %in% c("--help", "-h")) {
occurrences <- as.numeric(system(sprintf("grep -- 'docopt(doc\\|parse_args' %s | wc -l", opts$r_script), intern = T))
if (occurrences > 0){
cat("\n")
system(sprintf("Rscript %s --help", opts$r_script))
cat("\n")
quit()
} else {
cat("\nNo help available for", basename(opts$r_script) ,"\n")
quit()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment