inid 0.1.0

A library for parsing config files


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

inid

A library for parsing config files in .ini format

Usage

import inid;

import std.stdio;

struct Config
{
    struct Server
    {
        string address;
        ushort port;
    }

    Server srv;
}

enum CONFIG_STR = "
[SERVER]
address = 127.0.0.1
port = 4711
";

void main ( )
{
    auto config = ConfigParser!Config(CONFIG_STR);

    writefln("Server address: %s", config.srv.address);
    writefln("Listening on port: %s", config.srv.port);
}

Parsing a file

Assume there exists a file called config.ini in the current working directory:

import inid;

import std.stdio;

struct Config
{
    struct Server
    {
        string address;
        ushort port;
    }

    Server srv;
}

void main ( )
{
    auto config = parseConfigFile!Config("config.ini");

    writefln("Server address: %s", config.srv.address);
    writefln("Listening on port: %s", config.srv.port);
}
Authors:
  • Stefan Brus
Dependencies:
none
Versions:
0.1.0 2016-May-04
~master 2016-May-04
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 150 downloads total

Score:
0.2
Short URL:
inid.dub.pm