{"id":13739518,"url":"https://github.com/ziglibs/ini","last_synced_at":"2025-04-30T23:30:54.357Z","repository":{"id":45024826,"uuid":"355477645","full_name":"ziglibs/ini","owner":"ziglibs","description":"A teeny tiny ini parser","archived":false,"fork":false,"pushed_at":"2025-03-11T13:00:11.000Z","size":23,"stargazers_count":29,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T05:51:16.524Z","etag":null,"topics":["ini","ini-parser","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ziglibs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"MasterQ32"}},"created_at":"2021-04-07T08:58:07.000Z","updated_at":"2025-03-11T13:00:16.000Z","dependencies_parsed_at":"2024-02-04T13:43:43.994Z","dependency_job_id":"b53e1a3c-ef00-4a2e-9840-73c1f9ad4b64","html_url":"https://github.com/ziglibs/ini","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziglibs","download_url":"https://codeload.github.com/ziglibs/ini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251799383,"owners_count":21645790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ini","ini-parser","zig","zig-package","ziglang"],"created_at":"2024-08-03T04:00:34.788Z","updated_at":"2025-04-30T23:30:54.351Z","avatar_url":"https://github.com/ziglibs.png","language":"Zig","funding_links":["https://github.com/sponsors/MasterQ32"],"categories":["Applications"],"sub_categories":[],"readme":"# INI parser library\n\nThis is a very simple ini-parser library that provides:\n- Raw record reading\n- Leading/trailing whitespace removal\n- Comments\n- Zig API\n- C API\n\n## Usage example\n\n### Zig \n\n```zig\nconst std = @import(\"std\");\nconst ini = @import(\"ini\");\n\npub fn main() !void {\n    const file = try std.fs.cwd().openFile(\"example.ini\", .{});\n    defer file.close();\n\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer if (gpa.deinit() != .ok) @panic(\"memory leaked\");\n    var parser = ini.parse(gpa.allocator(), file.reader(), \";#\");\n    defer parser.deinit();\n\n    var writer = std.io.getStdOut().writer();\n\n    while (try parser.next()) |record| {\n        switch (record) {\n            .section =\u003e |heading| try writer.print(\"[{s}]\\n\", .{heading}),\n            .property =\u003e |kv| try writer.print(\"{s} = {s}\\n\", .{ kv.key, kv.value }),\n            .enumeration =\u003e |value| try writer.print(\"{s}\\n\", .{value}),\n        }\n    }\n}\n```\n\n### C\n\n```c\n#include \u003cini.h\u003e\n\n#include \u003cstdio.h\u003e\n#include \u003cstdbool.h\u003e\n\nint main() {\n  FILE * f = fopen(\"example.ini\", \"rb\");\n  if(!f)\n    return 1;\n\n  struct ini_Parser parser;\n  ini_create_file(\u0026parser, f, \";#\", 2);\n\n  struct ini_Record record;\n  while(true)\n  {\n    enum ini_Error error = ini_next(\u0026parser, \u0026record);\n    if(error != INI_SUCCESS)\n      goto cleanup;\n\n    switch(record.type) {\n      case INI_RECORD_NUL: goto done;\n      case INI_RECORD_SECTION:\n        printf(\"[%s]\\n\", record.section);\n        break;\n      case INI_RECORD_PROPERTY:\n        printf(\"%s = %s\\n\", record.property.key, record.property.value);\n        break;\n      case INI_RECORD_ENUMERATION:\n        printf(\"%s\\n\", record.enumeration);\n        break;\n    }\n\n  }\ndone:\n\ncleanup:\n  ini_destroy(\u0026parser);\n  fclose(f);\n  return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziglibs%2Fini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziglibs%2Fini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziglibs%2Fini/lists"}