Skip to content

jonase/clojure-ini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clojure-ini

A small library for reading .ini files into Clojure maps.

Installation

Using maven

Add

<dependency>
  <groupId>clojure-ini</groupId>
  <artifactId>clojure-ini</artifactId>
  <version>0.0.2</version>
</dependency>

to your pom.xml file.

Using leiningen

Add [clojure-ini "0.0.2"] as a dependency to your project.clj.

Usage

(read-ini source & opts) where source can be anything accepted by io/reader. Valid options are

  • :keywordize? (default false): Turn segments and property-keys into keywords
  • :trim? (default true): trim segments, keys and values
  • :allow-comments-anywhere? (default true): Comments can appear anywhere, and not only at the beginning of a line
  • :comment-char (default \;)

Example

conf.ini:

; last modified 1 April 2001 by John Doe
name=John Doe
organization=Acme Widgets Inc.

[database]
; use IP address in case network name resolution is not working
server=192.0.2.62     
port=143
file = payroll.dat

REPL session:

> (use 'clojure-ini.core)
> (read-ini "conf.ini" :keywordize? true)
{:database {:file "payroll.dat"
            :port "143"
            :server "192.0.2.62"}
 :organization "Acme Widgets Inc." 
 :name "John Doe"}

License

Copyright (C) 2011-2014 Jonas Enlund

Distributed under the Eclipse Public License, the same as Clojure.

About

Read .ini-files into Clojure maps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published