A lightweight INI file parser and writer for Cuis Smalltalk
# Cuis-Smalltalk-INI A lightweight INI file parser and writer for Cuis Smalltalk. ## Installation Download `INI.pck.st` and: ```smalltalk Feature require: 'INI'. ``` Or Drag and drop `INI.pck.st` file into Cuis. ## Examples ### Parse data from string ```smalltalk | config | config := INIConfig fromString: ' [database] host = localhost port = 5432 debug = yes '. config at: 'database' at: 'host'. "Result: 'localhost'" config at: 'database' at: 'port' as: #number. "Result: 5432" config at: 'database' at: 'debug' as: #boolean. "Result: true" ``` ### Parse data from file ```smalltalk | config | config := INIConfig fromFile: '/path/to/config.ini'. ``` ### Write to file ```smalltalk | config | config := INIConfig new. config at: 'app' at: 'name' put: 'MyApp'. config at: 'app' at: 'version' put: '1.0.0'. config at: 'DEFAULT' at: 'language' put: 'en'. config saveTo: '/path/to/output.ini'. ``` ### Create ```smalltalk | config | config := INIConfig new. config at: 'app' at: 'name' put: 'MyApp'. config at: 'app' at: 'version' put: '1.0.0'. config at: 'DEFAULT' at: 'language' put: 'en'. config toString. ``` Result: ```ini language = en [app] name = MyApp version = 1.0.0 ``` ### Modify ```smalltalk | config | config := INIConfig fromString: ' [database] host = localhost port = 5432 debug = yes '. config at: 'database' at: 'port' put: 8080. config toString ``` Result: ```ini [database] debug = yes host = localhost port = 8080 ```