ArztKlein / acf

Configuration file format for Python. ACF stands for Advanced Configuration Format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ACF Advanced Configuration Format

Merging configuration files and programming languages so you don't have to create an interpreter for every project.

Get ACF syntax hightlighting for VS Code here.

Installation

Install with pip install acfile

Usage with Python

Read an ACF file

from acfile import read_file

config = read_file("<FILE_PATH>.acf")

Read values

To read values, get the section name and then the value name from the acf object.

print(config.SECTION_NAME.VALUE_NAME)

ACF documentation

The file extension for an acf file is .acf.

Sections

ACF has a section-based structure where the header is preceded by an @ symbol. Example: @header. Each section contains key-value pairs.

Values

A value contains a name and a value seperated by an equals symbol. Text values must be enclosed with speech marks.

Example:

text = "this is text"
number = 42

Referencing other values

As long as the value is in the same section, you can refernce them to perform math operations on. Order of operations is supported

Examples:

a = 12
b = 2 + 3 * a

The value b will have the value of 38.

a = "hello"
b = 3 * a

The value b will be "hellohellohello" as operators on strings have the same behaviour as in Python.

Comments

Inline comments begin with a semicolon ;.

About

Configuration file format for Python. ACF stands for Advanced Configuration Format

License:GNU General Public License v3.0


Languages

Language:Python 100.0%