{"id":18858377,"url":"https://github.com/stephenberry/argz","last_synced_at":"2025-09-08T05:33:52.720Z","repository":{"id":40366216,"uuid":"472871316","full_name":"stephenberry/argz","owner":"stephenberry","description":"A light weight C++ in memory argument parser","archived":false,"fork":false,"pushed_at":"2024-05-30T16:02:43.000Z","size":59,"stargazers_count":56,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-21T12:44:27.063Z","etag":null,"topics":["argument-parser","argument-parsing","command-line","cplusplus","cpp20","in-memory"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephenberry.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,"zenodo":null}},"created_at":"2022-03-22T17:38:24.000Z","updated_at":"2025-02-20T19:47:00.000Z","dependencies_parsed_at":"2025-04-14T12:03:58.396Z","dependency_job_id":"0e913556-6fd2-4588-9a76-5abfcdd64dc6","html_url":"https://github.com/stephenberry/argz","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/stephenberry/argz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenberry%2Fargz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenberry%2Fargz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenberry%2Fargz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenberry%2Fargz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephenberry","download_url":"https://codeload.github.com/stephenberry/argz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenberry%2Fargz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270683968,"owners_count":24627773,"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-08-16T02:00:11.002Z","response_time":91,"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-parser","argument-parsing","command-line","cplusplus","cpp20","in-memory"],"created_at":"2024-11-08T04:12:21.235Z","updated_at":"2025-08-16T07:34:23.202Z","avatar_url":"https://github.com/stephenberry.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# argz\nA light weight C++ in memory argument parser.\n\n## Highlights\n\n* Single header file\n* Requires C++20\n* Less than 200 lines of code\n* Apache 2.0 License\n\n## Quick Start\n\nSimply include `argz.hpp` and you're good to go.\n\n```cpp\n#include \u003cargz/argz.hpp\u003e\n```\n\nStart with an about:  `argz::about`\n\n```cpp\nconstexpr std::string_view version = \"1.2.3\";\nargz::about about{ \"My program description\", version };\n```\n\nTo add a new argument, simply create ```argz::options```. Provide a list of argument names that you want to group together, e.g. ```-i``` and ```--input```.\n\n```cpp\nstd::string input{};\nstd::string study{};\nint number = 123;\nbool boolean = true;\nstd::optional\u003cint\u003e number_opt{};\nargz::options opts{\n   { { \"input\", 'i' }, input, \"the input file\"},\n   { { \"study\", 's' }, study, \"a study file\"},\n   { { \"number\" }, number, \"input an int\"},\n   { { \"boolean\" }, boolean, \"a boolean\" },\n   { { \"number_opt\" }, number_opt, \"input an int\"}\n};\n```\n\nNow to parse command line arguments:\n\n```cpp\ntry {\n    argz::parse(about, opts, argc, argv);\n}\ncatch (const std::exception\u0026 e) {\n    std::cerr \u003c\u003c e.what() \u003c\u003c '\\n';\n}\n```\n\n**That is all!**\n\n\u003e Note that we don't have to cast out (.e.g. `.as\u003cint\u003e`) from our argument parser because it reads directly into the variables passed in as options!\n\n### Printing Help\n\n`-h` prints a help message, including the program usage and information about the arguments registered with the Argz Parser. An example help message:\n\n```\nMy program description\nVersion: 1.2.3\n\n-h, --help              write help to console\n-v, --version           write the version to console\n-i, --input             the input file\n-s, --study             a study file\n--number                input an int, default: 123\n--boolean               a boolean, default: 1\n```\n\n### Supported Input Types\n\n`bool`, `int32_t`, `uint32_t`, `int64_t`, `uint64_t`, `std::string`\n\nAnd `std::optional\u003cT\u003e` where `T` is any of the above types except `bool`\n\n### Accept No Inputs Without Printing Help\n\nBy default the help is printed when no inputs are given. If this behavior is not desirable, set `print_help_when_no_options` to false inside of `argz::about`.\n\n```c++\nargz::about about{ \"My program description\", version,\n                 .print_help_when_no_options = false };\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenberry%2Fargz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenberry%2Fargz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenberry%2Fargz/lists"}