summaryrefslogtreecommitdiff
path: root/snippets
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-01-13 23:29:50 -0500
committerKyle Meyer <kyle@kyleam.com>2017-01-16 18:51:46 -0500
commit0ca7307ae9c4931067925d9bf0b85059a17f6933 (patch)
treeeca3569adf65f0db02be251253f6b3ead598cc24 /snippets
parent245f6dd7ebf4efaee769528f16394c6b1c0b7040 (diff)
downloademacs.d-0ca7307ae9c4931067925d9bf0b85059a17f6933.tar.gz
snippets: Add R commandArgs template
Diffstat (limited to 'snippets')
-rw-r--r--snippets/ess-mode/command-args9
1 files changed, 9 insertions, 0 deletions
diff --git a/snippets/ess-mode/command-args b/snippets/ess-mode/command-args
new file mode 100644
index 0000000..87b6643
--- /dev/null
+++ b/snippets/ess-mode/command-args
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: command args
+# key: cargs
+# --
+args <- commandArgs(trailingOnly = TRUE)
+if (length(args) != $1)
+ stop("Usage: `(file-name-nondirectory (buffer-file-name))` $2")
+
+$0 <- args[1]