{"id":20090499,"url":"https://github.com/qookei/conflict","last_synced_at":"2026-06-09T17:31:40.312Z","repository":{"id":110462569,"uuid":"487143463","full_name":"qookei/conflict","owner":"qookei","description":"C++17 command line argument parser","archived":false,"fork":false,"pushed_at":"2022-05-11T22:32:13.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T15:31:06.629Z","etag":null,"topics":["command-line","cpp","cpp17","parser"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qookei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-04-30T00:18:16.000Z","updated_at":"2022-09-10T19:09:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"2382c932-1789-4da2-aa91-39268ecd3c61","html_url":"https://github.com/qookei/conflict","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/qookei/conflict","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qookei%2Fconflict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qookei%2Fconflict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qookei%2Fconflict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qookei%2Fconflict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qookei","download_url":"https://codeload.github.com/qookei/conflict/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qookei%2Fconflict/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34118751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"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":["command-line","cpp","cpp17","parser"],"created_at":"2024-11-13T16:24:43.857Z","updated_at":"2026-06-09T17:31:40.291Z","avatar_url":"https://github.com/qookei.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conflict\n\nC++17 command-line argument parser with no extra dependencies.\n\n## Features\n\n - Generating help messages based on available options,\n - Support for simple options, string options, and single and multiple choice options, with default value support,\n - Support for custom option types.\n\n## Requirements\n - C++17 compiler,\n - Meson and Ninja (for installing and running tests).\n\n## Using\n\nConflict is a header-only library, and as such adding it's `include/` directory\nto the include path is sufficient.\n\nYou can also use one of the following alternatives.\n\n### Installing\n\nTo install the library, you should use the Meson project.\n\nConfigure the project with `-Dinstall_headers=true`, and an appropriate prefix\n(e.g. `--prefix=/usr`), then install it with `ninja install` (setting the `DESTDIR`\nenvironment variable as needed).\n\nIn addition to the headers, a pkg-config file is also installed, to allow for detecting the library.\n\n### Meson subproject\n\nYou can use the following wrap file to add Conflict as a dependency:\n\n```ini\n[wrap-git]\nurl = https://github.com/qookei/conflict.git\nrevision = master\n\n[provide]\ndependency_names = conflict\n```\n\nUsing this file, you can now bring in Conflict into your project:\n\n```meson\nconflict_dep = dependency('conflict')\n```\n\n## Example\n\nHere is an example showcasing all the basic features of Conflict. A fully fleshed\nout version of this program can also be found here: [tests/example.cpp](tests/example.cpp)\n([build tests](#running) to build it as well).\n\n```cpp\n#include \u003cconflict/conflict.hpp\u003e\n\nuint64_t flags;\nuint64_t feature_flags;\nuint64_t language;\nstd::string_view output;\nstd::vector\u003cstd::string_view\u003e files;\n\nconst auto parser = conflict::parser{\n\t// You can define simple command line option that only set a value ...\n\tconflict::option{{'h', \"help\", \"Show help\"}, flags, (1 \u003c\u003c 0)},\n\tconflict::option{{'V', \"version\", \"Show version\"}, flags, (1 \u003c\u003c 1)},\n\t// Options may not have a short variant.\n\tconflict::option{{\"verbose\", \"Be verbose\"}, flags, (1 \u003c\u003c 2)},\n\t// ... and options which consume a string ...\n\tconflict::string_option{{'o', \"output\", \"Output file name\"}, \"filename\", output},\n\t// ... and options which consume a combination of flags, and which allow for complex selections like all,-feat2,exp1 ...\n\tconflict::choice{{'f', \"features\", \"Feature settings\"}, conflict::choice_mode::combine, feature_flags,\n\t\tconflict::flag{{\"all\", \"All features\"}, 0b111, conflict::flag::is_default},\n\t\tconflict::flag{{\"feat1\", \"Feature 1\"}, 1 \u003c\u003c 0},\n\t\tconflict::flag{{\"feat2\", \"Feature 2\"}, 1 \u003c\u003c 1},\n\t\tconflict::flag{{\"feat3\", \"Feature 3\"}, 1 \u003c\u003c 2},\n\t\tconflict::flag{{\"exp1\", \"Experimental feature 1\"}, 1 \u003c\u003c 3},\n\t},\n\t// ... and options which pick one out of a list of flags.\n\tconflict::choice{{'l', \"language\", \"Language to use\"}, conflict::choice_mode::replace, language,\n\t\tconflict::flag{{\"system\", \"System language\"}, 1, conflict::flag::is_default},\n\t\t// Descriptions are also optional, the only non-optional part is the long string.\n\t\tconflict::flag{{\"english\"}, 2},\n\t\tconflict::flag{{\"polish\"}, 3},\n\t\tconflict::flag{{\"german\"}, 4},\n\t\tconflict::flag{{\"spanish\"}, 5},\n\t}\n};\n\nint main(int argc, char **argv) {\n\t// Reset all flags to their default values.\n\tparser.apply_defaults();\n\n\t// Skip the program name, and collect any other arguments into `files`.\n\tauto st = parser.parse(argc - 1, argv + 1, files);\n\n\t// Report any errors and exit\n\tconflict::default_report(st);\n\n\tif (flags \u0026 (1 \u003c\u003c 0)) {\n\t\tparser.print_help();\n\t\treturn 0;\n\t}\n\n\t// ...\n}\n```\n\n## Tests\n\nConflict comes with a test suite which aims to test the functionality of the whole library.\n\n### Additional requirements\n\n - GTest,\n - Lcov and GenHTML, or Gcovr (for coverage reports only).\n\n### Running\n\nTo build and run the test suite, run the following command:\n\n```\n$ meson builddir -Dbuild_tests=true\n$ ninja -C builddir test\n```\n\n### Coverage\n\nYou may also wish to pass `-Db_coverage=true` to the Meson invocation to enable coverage reports.\nTo generate them, after running the tests, run the following:\n\n```\n$ ninja -C builddir coverage-html # or text, xml, sonarqube\n```\n\n## License\n\nThis project is licensed under the Zlib license. Check [LICENSE.md](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqookei%2Fconflict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqookei%2Fconflict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqookei%2Fconflict/lists"}