{"id":18879660,"url":"https://github.com/bbfh-dev/parsex","last_synced_at":"2025-07-09T01:10:04.861Z","repository":{"id":257102650,"uuid":"857313290","full_name":"bbfh-dev/parsex","owner":"bbfh-dev","description":"A GNU-/POSIX-compiant CLI argument parsing and validation library","archived":false,"fork":false,"pushed_at":"2024-11-03T09:01:27.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T03:12:35.979Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbfh-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-09-14T10:17:46.000Z","updated_at":"2024-11-03T09:01:31.000Z","dependencies_parsed_at":"2024-09-14T21:38:29.837Z","dependency_job_id":"3ee06847-c4a1-4d02-b0e1-9a0bd6ff45b2","html_url":"https://github.com/bbfh-dev/parsex","commit_stats":null,"previous_names":["bbfh-dev/parsex"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fparsex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fparsex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fparsex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fparsex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbfh-dev","download_url":"https://codeload.github.com/bbfh-dev/parsex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239841742,"owners_count":19705981,"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":[],"created_at":"2024-11-08T06:38:23.488Z","updated_at":"2025-07-09T01:10:04.855Z","avatar_url":"https://github.com/bbfh-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parsex\n\nParsex `/pɑːrsɛks/` — a GNU-/POSIX-compiant CLI argument parsing and validation library.\n\n## Features\n\n- Supports `--flags`, `--options \u003cvalue\u003e` and `subcommands`.\n- Recognizes all argument formats: `-a`, `-abc`, `-flag`, `-opt=value`, `-opt value`, `--flag`, `--flag=value`, `--flag value`.\n- Supports `--` to separate arguments.\n\n## Table of contents\n\n\u003c!-- vim-markdown-toc GFM --\u003e\n\n* [Example usage](#example-usage)\n\n\u003c!-- vim-markdown-toc --\u003e\n\n## Example usage\n\n```go\npackage main\n\nimport (\n    \"os\"\n\n    \"github.com/bbfh-dev/parsex/v2\"\n)\n\nvar Options struct {\n    Verbose    bool   `alt:\"v\" desc:\"Print verbose debug information\"`\n    Debug      bool   `alt:\"d\" desc:\"Run the program in DEBUG mode\"`\n    Input      string `desc:\"Some input file\"`\n    SomeNumber int    `alt:\"N\" desc:\"A valid integer\"`\n}\n\nvar program = parsex.Program{\n    // You can set it to `nil` if you don't have any options\n    Data: \u0026Options,\n    Name: \"example\",\n    Desc: \"This is an example program\",\n    Exec: func(args []string) error {\n        // I use an annonymous function just for demo.\n        // This is what's gonna be called with the positional arguments\n        // provided in [args] and all options saved to [Options]\n        return nil\n    },\n}.Runtime().SetVersion(\"1.0.0-dev\").SetPosArgs(\"arg1\", \"arg2?\", \"argN...\")\n\nfunc main() {\n    err := program.Run(os.Args[1:])\n    if err != nil {\n        // All errors are typed, allowing you to know exactly what went wrong.\n        // Regarless of how you handle them\n        // err.Error() should be enough information for the user.\n        switch err := err.(type) {\n        case parsex.ErrExecution:\n            // You can access the various properties provided into the error\n            if err.ErrKind == parsex.ErrKindExecIsNil \u0026\u0026 err.Name == \"example\" {\n                // In case you want to handle a specific error\n            }\n        default:\n            os.Stderr.WriteString(err.Error() + \"\\n\")\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbfh-dev%2Fparsex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbfh-dev%2Fparsex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbfh-dev%2Fparsex/lists"}