mini

mini (matter.ini) is a powerful configuration file(.ini, .cfg) parser for haxe
https://github.com/hackx2/hxmini

To install, run:

haxelib install mini 1.1.1 

See using Haxelib in Haxelib documentation for more information.

README.md



e

Matter.ini 🌌 is a lightweight and simple library for parsing .ini data.
It offers an easy way to read, modify, and create your own .ini data.


Features :p

  • Comment Support: Ignores nodes starting with a semicolon(;) or an hashtag (#).
  • Multi-line support: Allows you to define a node using triple quotation marks (""" """)
  • File Creation & Editing: Lets you create and edit .ini files

Installation 🔧

You can install the library directly using haxelib.

haxelib install mini

Or you could install using git.

haxelib git mini https://github.com/hackx2/hxmini.git

Usage

Parse & Access .ini data

Here is a simple example of how to use the parser in your Haxe project.

First, let's assume you have a file named config.ini with the following contents:

`ini [main.test] name="hackx2" meows="meow"`

Now, you can parse this file and access its data:

import mini.Parser;


// Get `testing.ini`'s file content.
final content : String = sys.io.File.getContent('testing.ini');

// Parse the content.
final ini:Ini = Parser.parse(content);

// Get the element.
final main:Ini = ini.elementsNamed("main.test").next();

// Get and print data.
Sys.println(main.get('name')); // Returns "hackx2"
Sys.println(main.get('meows')); // Returns "meow"

// -----------------------------

Create your own .ini files

Heres how you can create a .ini file:

// Create the document.
final ini:Ini = Ini.createDocument();

// Create a Section
final user:Ini = Ini.createSection("User");
user.set("username", "Milo");
user.set("role", "Admin");
user.set("progress", "78%");
ini.addChild(user);

user.get('progress'); // Returns: "78%"

ini.toString(); // Returns the serialized .ini document


Contribution (yippie)

Contributions are always welcome and appreciated!!! 💖If you have a bug or have any suggestions, please open an issue.


License

This project is licensed under the MIT License.

Contributors
hackx2
Version
1.1.1
Published
3 months ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub