This repository implements an ini config parser
InitParser()
returns a parser object to call our APIsLoadFromString()
takes a string ini configs and parses them into the caller iniParser objectLoadFromFile()
takes an ini file path and parses it into the caller iniParser objectGetSectionNames()
returns an array of strings having the names of the sections of the caller iniParser objectGetSections()
returns a representing the parsed data structure of the caller iniParser objectGet()
takes a sectionName and a key and returns the value of this key and an error if foundSet()
takes a sectionName, a key and a value, it sets the passed key with the passed value and returns an error if foundToString()
returns the parsed ini map of the caller object as one stringSaveToFile()
takes a path to an output file, saves the parsed ini map of the caller object into a file and returns an error if found
-
import github.com/codescalersinternships/RawanMostafa-inigo
-
Initialize the parser first
parser := InitParser()
-
Example usage:
parser.LoadFromString(s)
parser.LoadFromFile(filepath)
names := parser.GetSectionNames()
sections := parser.GetSections()
value, err := parser.Get(sectionName, key)
err = parser.Set(sectionName, key, value)
s := parser.ToString()
err = parser.SaveToFile(outPath)