README.md

inir

Build Status codecov.io

inir is a .ini/.cfg file parser

About .ini/.cfg files: the INI file Wikipedia page

Installation

install.packages("devtools")
devtools::install_github("sckott/inir")
library("inir")

Parse a file

Get a file

gitfile <- system.file("examples", "gitconfig.ini", package = "inir")

instantiate new object with file path

(res <- ini(gitfile))
#> <<ini config file>> gitconfig.ini.

get file path

res$file
#> [1] "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/inir/examples/gitconfig.ini"

read file

res$read()
#> $gitconfig.ini
#> <<ini config file>> gitconfig.ini
#>   sections (length): 
#>     core: 6
#>     remote "origin": 2
#>     branch "master": 2
#>     travis: 1

get section names

res$sections()
#> [1] "core"              "remote \"origin\"" "branch \"master\""
#> [4] "travis"

get contents of a single section

res$get("core")
#> $repositoryformatversion
#> [1] "0"
#> 
#> $filemode
#> [1] "true"
#> 
#> $bare
#> [1] "false"
#> 
#> $logallrefupdates
#> [1] "true"
#> 
#> $ignorecase
#> [1] "true"
#> 
#> $precomposeunicode
#> [1] "true"

Meta



sckott/inir documentation built on May 29, 2019, 4:01 p.m.