Skip to content
/ go-ini Public

A Go package tailored for manipulation, reading, and writing of INI files. This package is specifically designed to be compliant with Magic Software's "Magic.ini" format.

License

Notifications You must be signed in to change notification settings

devzolo/go-ini

Repository files navigation

go-ini 🚀

go-ini is a Go package tailored for manipulation, reading, and writing of INI files. This package is specifically designed to be compliant with Magic Software's "Magic.ini" format.

Magic fun img

Go Reference

💡 Features

  • Magic Software Compliance: Adheres to the "Magic.ini" format specifications.
  • Load and Parse: Efficiently reads INI files.
  • Write and Update: Capable of writing updates to existing INI files or creating new ones.
  • Section and Key Extraction: Extract sections and keys from INI content with ease.
  • Value Translation: Translate values based on translatable sections.

🛠 Usage

🔧 Installation

To install the package, use:

go get github.com/devzolo/go-ini

Basic Usage

package main

import (
  "fmt"

  "github.com/devzolo/go-ini"
)

func main() {
  cfg := ini.NewMagicIni()
  err := cfg.LoadIni("path/to/your/magic.ini")
  if err != nil {
    panic(err)
  }
  value := cfg.Get("SomeSection", "SomeKey")
  fmt.Println(value)
}

📚 Documentation

📄 MagicIni Structure

Represents a structured format of an INI file compliant with the "Magic.ini" standards. It houses the parsed data, the currently parsed section, and the section with translatable strings.

🛠 Primary Methods

  • NewMagicIni(): Creates and returns a new MagicIni instance.
  • LoadIni(path string): Reads and parses an INI file, particularly "Magic.ini", from the specified path.
  • LoadAdditionalIni(path string): Loads an additional INI file from the specified path, merging its contents with the existing data.
  • Get(section string, key string): Fetches a value for a specific section and key.
  • Translate(str string): Translates placeholders in the provided string using the corresponding strings from the TranslatableSection.

About

A Go package tailored for manipulation, reading, and writing of INI files. This package is specifically designed to be compliant with Magic Software's "Magic.ini" format.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published