From f1756a358d589d9a7fff99abec0f4a23cf9390af Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Sat, 14 Feb 2015 13:51:42 -0800 Subject: [PATCH] first commit --- .Rbuildignore | 3 +++ .gitignore | 5 +++++ DESCRIPTION | 13 +++++++++++++ LICENSE | 2 ++ NAMESPACE | 4 ++++ R/minimist.R | 16 ++++++++++++++++ R/onLoad.R | 6 ++++++ inst/.DS_Store | Bin 0 -> 6148 bytes inst/js/minimist.min.js | 1 + man/minimist.Rd | 25 +++++++++++++++++++++++++ minimist.Rproj | 21 +++++++++++++++++++++ 11 files changed, 96 insertions(+) create mode 100644 .Rbuildignore create mode 100644 .gitignore create mode 100644 DESCRIPTION create mode 100644 LICENSE create mode 100644 NAMESPACE create mode 100644 R/minimist.R create mode 100644 R/onLoad.R create mode 100644 inst/.DS_Store create mode 100644 inst/js/minimist.min.js create mode 100644 man/minimist.Rd create mode 100644 minimist.Rproj diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..7d596de --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1,3 @@ +^.*\.Rproj$ +^\.Rproj\.user$ +.V8history diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..719b70b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.Rproj.user +.Rhistory +.RData +.V8history +*/.DS_Store diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000..da660af --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,13 @@ +Package: minimist +Type: Package +Title: Parse Argument Options +Version: 0.1 +Date: 2015-02-14 +Author: Jeroen Ooms, James Halliday +Maintainer: Jeroen Ooms +Description: A binding to the minimist JavaScript library. This module implements + the guts of optimist's argument parser without all the fanciful decoration. +License: MIT + file LICENSE +Imports: V8 (>= 0.5) +URL: https://github.com/jeroenooms/minimist, https://www.npmjs.com/package/minimist +BugReports: https://github.com/jeroenooms/minimist/issues diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..71586a8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2015 +COPYRIGHT HOLDER: Jeroen Ooms diff --git a/NAMESPACE b/NAMESPACE new file mode 100644 index 0000000..063411c --- /dev/null +++ b/NAMESPACE @@ -0,0 +1,4 @@ +# Generated by roxygen2 (4.1.0): do not edit by hand + +export(minimist) +importFrom(V8,new_context) diff --git a/R/minimist.R b/R/minimist.R new file mode 100644 index 0000000..62c271a --- /dev/null +++ b/R/minimist.R @@ -0,0 +1,16 @@ +#' Parse argument options +#' +#' This module is the guts of optimist's argument parser without all the fanciful +#' decoration. +#' +#' Parses a vector of strings (e.g. from \code{\link{commandArgs}}) into the proper key/value list. +#' +#' @export +#' @param args a character vector with arguments +#' @examples minimist() +#' minimist(c("-a", "beep", "-b", "boop")) +#' args = c("-x", "3", "-y", "4", "-n5", "-abc", "--beep=boop", "foo", "bar", "baz") +#' minimist(args) +minimist <- function(args = commandArgs()){ + ct$call("minimist", as.list(args)) +} diff --git a/R/onLoad.R b/R/onLoad.R new file mode 100644 index 0000000..1cc1e62 --- /dev/null +++ b/R/onLoad.R @@ -0,0 +1,6 @@ +#' @importFrom V8 new_context +ct <- NULL +.onLoad <- function(libname, pkgname){ + ct <<- new_context(); + ct$source(system.file("js/minimist.min.js", package = pkgname)) +} diff --git a/inst/.DS_Store b/inst/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ba3b77f6a8c3248a9cea646d67980a85d45fcca5 GIT binary patch literal 6148 zcmeH~Jr2S!425lAKw|00n1usyg9yP1xBvnsRH*}E&(V4QVW2Rh3O!5q7rU|AzM-i_ zM0bztR-_Y=CEO?*3nNqHGr7tAdcXANVd$-pHcMIw-pT0tYadAkr~nn90#twsOh