mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
494 B
25 lines
494 B
9 years ago
|
|
||
|
args = commandArgs(TRUE);
|
||
|
|
||
|
args.options = list();
|
||
|
|
||
|
temp.option.key = NULL;
|
||
|
|
||
|
for (arg in args) {
|
||
|
# Optional arguments declaration
|
||
|
if (substring(arg, 1, 1) == '-') {
|
||
|
temp.option.key = substring(arg, 2);
|
||
|
if (substring(arg, 2, 2) == '-') {
|
||
|
temp.option.key = substring(arg, 3);
|
||
|
}
|
||
|
|
||
|
args.options[[temp.option.key]] = TRUE;
|
||
|
}
|
||
|
# Optional arguments value
|
||
|
else if (!is.null(temp.option.key)) {
|
||
|
args.options[[temp.option.key]] = arg;
|
||
|
|
||
|
temp.option.key = NULL;
|
||
|
}
|
||
|
}
|