{"id":27132781,"url":"https://github.com/operachi061/mini-parser","last_synced_at":"2025-10-26T16:45:10.392Z","repository":{"id":286610576,"uuid":"961940542","full_name":"Operachi061/mini-parser","owner":"Operachi061","description":"A very-minimal command-line parser","archived":false,"fork":false,"pushed_at":"2025-07-28T20:59:28.000Z","size":11,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-28T22:33:38.602Z","etag":null,"topics":["argument-parsing","command-line","command-line-parser","minimal","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Operachi061.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,"zenodo":null}},"created_at":"2025-04-07T12:06:37.000Z","updated_at":"2025-07-28T20:59:32.000Z","dependencies_parsed_at":"2025-07-28T22:22:15.921Z","dependency_job_id":"4fd6c144-9b85-496d-a574-a17dd8bb3819","html_url":"https://github.com/Operachi061/mini-parser","commit_stats":null,"previous_names":["operachi061/mini-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Operachi061/mini-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Operachi061%2Fmini-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Operachi061%2Fmini-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Operachi061%2Fmini-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Operachi061%2Fmini-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Operachi061","download_url":"https://codeload.github.com/Operachi061/mini-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Operachi061%2Fmini-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281139059,"owners_count":26450137,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["argument-parsing","command-line","command-line-parser","minimal","zig","zig-package","ziglang"],"created_at":"2025-04-07T22:26:36.378Z","updated_at":"2025-10-26T16:45:10.387Z","avatar_url":"https://github.com/Operachi061.png","language":"Zig","readme":"# mini-parser\nmini-parser is a very-minimal parser for the [Zig](https://ziglang.org) language.\n\n## Example\n```zig\nconst std = @import(\"std\");\nconst mini_parser = @import(\"mini-parser\");\nconst debug = std.debug;\nconst posix = std.posix;\n\nconst usage =\n    \\\\Usage: example [OPTIONS]\n    \\\\\n    \\\\Options:\n    \\\\  --help,       -h    Display help list\n    \\\\  --text=TEXT,  -t    Print the text\n    \\\\  --bool,       -b    Enable the boolean\n    \\\\\n;\n\npub fn main() !void {\n    var i: usize = 0;\n    while (std.os.argv.len \u003e i) : (i += 1) {\n        var args: usize = 1;\n\n        blk: while (true) {\n            const parser = try mini_parser.init(i, args, \u0026.{\n                .{ .long = \"help\", .short = 'h', .type = .boolean },\n                .{ .long = \"text\", .short = 't', .type = .argument },\n                .{ .long = \"bool\", .short = 'b', .type = .boolean },\n            });\n\n            switch (parser.arg) {\n                0 =\u003e {\n                    debug.print(\"no argument was given.\\n\", .{});\n                    posix.exit(0);\n                },\n                1 =\u003e {\n                    debug.print(\"argument '{s}' does not exist.\\n\", .{parser.val});\n                    posix.exit(0);\n                },\n                'h' =\u003e {\n                    debug.print(\"{s}\\n\", .{usage});\n                    posix.exit(0);\n                },\n                't' =\u003e {\n                    debug.print(\"Text: {s}\\n\", .{parser.val});\n                },\n                'b' =\u003e {\n                    debug.print(\"Enabled boolean!\\n\", .{});\n                },\n                else =\u003e {},\n            }\n\n            if (args != parser.args) {\n                args = parser.args;\n                continue :blk;\n            }\n\n            break;\n        }\n    }\n}\n```\n\n## Installation\n\nFetch mini-parser package to `build.zig.zon`:\n```sh\nzig fetch --save git+https://github.com/Operachi061/mini-parser\n```\n\nThen add following to `build.zig`:\n```zig\nconst mini_parser = b.dependency(\"mini_parser\", .{});\nexe.root_module.addImport(\"mini-parser\", mini_parser.module(\"mini-parser\"));\n```\n\nAfter building, test it via:\n```sh\n./example -tb foo --help\n```\n\n## Unlicense\nThis project is based on the [UNLICENSE](https://github.com/Operachi061/mini-parser/blob/main/UNLICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foperachi061%2Fmini-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foperachi061%2Fmini-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foperachi061%2Fmini-parser/lists"}