Last active
April 18, 2016 02:56
-
-
Save NoahMarconi/f310d4efccf61600c7df041a7cf5e66a to your computer and use it in GitHub Desktop.
run-r handler for Hook.io R runtime.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env r | |
# | |
# run-r handler for Hook.io R runtime. | |
# | |
# Copyright (C) 2016 Noah Marconi | |
# | |
# Released under MIT | |
doc <- "Usage: run-r [-c CODE] [-e ENVIRONMENT] [-s SERVICE] | |
-c CODE R code to evaluate. | |
-e ENVIRONMENT ? | |
-s SERVICE ?" | |
if (is.null(argv) | length(argv)<1) { | |
cat(doc, "\n") | |
q() | |
} | |
arg_flags_idx <- grep("^-", argv) | |
arg_vals_idx <- arg_flags_idx+1 | |
opts <- as.list(argv[arg_vals_idx]) | |
names(opts) <- argv[arg_flags_idx] | |
RAppArmor::eval.secure(parse(text=opts$`-c`)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment