{"id":34954766,"url":"https://github.com/pseudocc/pal","last_synced_at":"2026-05-24T19:03:42.472Z","repository":{"id":239423328,"uuid":"798882694","full_name":"pseudocc/pal","owner":"pseudocc","description":"A Zig configuration file parser library.","archived":false,"fork":false,"pushed_at":"2024-09-06T04:48:26.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-29T17:09:03.797Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pseudocc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-05-10T17:11:35.000Z","updated_at":"2024-09-06T04:47:55.000Z","dependencies_parsed_at":"2024-05-12T11:25:55.645Z","dependency_job_id":"bedcff87-a242-4f19-98ed-3966af0448ba","html_url":"https://github.com/pseudocc/pal","commit_stats":null,"previous_names":["pseudocc/pal"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/pseudocc/pal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudocc%2Fpal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudocc%2Fpal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudocc%2Fpal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudocc%2Fpal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pseudocc","download_url":"https://codeload.github.com/pseudocc/pal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudocc%2Fpal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33446639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-24T18:26:54.182Z","status":"ssl_error","status_checked_at":"2026-05-24T18:26:53.408Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-12-26T21:58:45.423Z","updated_at":"2026-05-24T19:03:42.457Z","avatar_url":"https://github.com/pseudocc.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PAL\n\n`pal` is a zig library that help you to load text configurations.\nThe configuration format is pretty simple:\n\n```\n# the comment\nkey             value\narray           item0, item1, item2\ntagged_union0   the_void\ntagged_union1   tag(value)\n```\n\nThe library is designed to be used in zig programs, it is tested on zig 0.12.0.\n\n## Usage\n\nTo create a default configuration at `comptime`:\n```zig\nconst pal = @import(\"pal\");\nconst Config = @This();\n\nconst Gender = union(enum) {\n  male,\n  female,\n  other: []const u8,\n};\n\nname: []const u8,\ngender: Gender,\nage: u8,\n\npub const default = pal.embed(Config,\n    \\\\name      nobody\n    \\\\gender    other(unknown)\n    \\\\age       0\n);\n```\nAnd of course, you can use `@embedFile` to load configurations from a file.\n\nTo load a configuration at runtime, you need to take care of the memory:\n```zig\nvar context = pal.string(Config, raw, allocator);\ndefer context.deinit();\nconst config = context.instance;\n\nvar context = pal.ParseContext(Config).init(allocator);\ndefer context.deinit();\ntry context.file(\"/home/user/some.conf\");\ntry context.string(\"age 1\");\n```\n\n### Special Keywords\n\n1. `config_dir`: the directory we try to find other configuration via `inlcude`.\ndefault is `std.fs.cwd()`.\n\n2. `include`: you may include other configurations in the configuration file.\nExample: see `test/theme.override.conf`\n\n### Type Spec\n\n1. `[]const u8`: will duplicate the raw string and return.\n    ```zig\n    // description  Better call Saul!\n    description: []const u8,\n    ```\n\n2. `Enum`: calling `std.meta.stringToEnum` under the hood.\n    ```zig\n    // os   linux\n    os: enum { linux, macos, windows, other },\n    ```\n3. Tagged `Union`: like `Enum` but inner values are surrounded by `()`.\n    ```zig\n    // os   linux(ubuntu)\n    // os   macos\n    // os   windows(11)\n    os: union(enum) {\n        linux: []const u8,\n        macos,\n        windows: u8,\n    },\n    ```\n\n4. `Array`/`Pointer`: split the raw string by `\",\"`, then parse the children.\n    ```zig\n    // triangle     5,12,13\n    triangle: [3]u32,\n    // fruits       apple,banana,cherry\n    fruits: []const Fruit,\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpseudocc%2Fpal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpseudocc%2Fpal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpseudocc%2Fpal/lists"}