11cb0ef41Sopenharmony_ci 21cb0ef41Sopenharmony_ciargs = commandArgs(TRUE); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciargs.options = list(); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_citemp.option.key = NULL; 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_cifor (arg in args) { 91cb0ef41Sopenharmony_ci # Optional arguments declaration 101cb0ef41Sopenharmony_ci if (substring(arg, 1, 1) == '-') { 111cb0ef41Sopenharmony_ci temp.option.key = substring(arg, 2); 121cb0ef41Sopenharmony_ci if (substring(arg, 2, 2) == '-') { 131cb0ef41Sopenharmony_ci temp.option.key = substring(arg, 3); 141cb0ef41Sopenharmony_ci } 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci args.options[[temp.option.key]] = TRUE; 171cb0ef41Sopenharmony_ci } 181cb0ef41Sopenharmony_ci # Optional arguments value 191cb0ef41Sopenharmony_ci else if (!is.null(temp.option.key)) { 201cb0ef41Sopenharmony_ci args.options[[temp.option.key]] = arg; 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci temp.option.key = NULL; 231cb0ef41Sopenharmony_ci } 241cb0ef41Sopenharmony_ci} 25