{"id":18605644,"url":"https://github.com/piotrpsz/clap","last_synced_at":"2025-05-17T09:42:29.933Z","repository":{"id":207948460,"uuid":"720483505","full_name":"piotrpsz/clap","owner":"piotrpsz","description":"C++ library for analyzing program call arguments.","archived":false,"fork":false,"pushed_at":"2023-11-20T12:10:25.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-18T02:14:58.952Z","etag":null,"topics":["cpp","cpp20"],"latest_commit_sha":null,"homepage":"","language":"C++","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/piotrpsz.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}},"created_at":"2023-11-18T16:18:12.000Z","updated_at":"2024-08-29T05:41:47.000Z","dependencies_parsed_at":"2023-11-18T18:01:18.919Z","dependency_job_id":null,"html_url":"https://github.com/piotrpsz/clap","commit_stats":null,"previous_names":["piotrpsz/clap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrpsz%2Fclap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrpsz%2Fclap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrpsz%2Fclap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrpsz%2Fclap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piotrpsz","download_url":"https://codeload.github.com/piotrpsz/clap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254595409,"owners_count":22097553,"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":["cpp","cpp20"],"created_at":"2024-11-07T02:22:25.622Z","updated_at":"2025-05-17T09:42:29.126Z","avatar_url":"https://github.com/piotrpsz.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clap\nC++ library for analyzing program call arguments.\n\u003cul\u003e\n    \u003cli\u003eyou can use single-letter (short) arguments in the call line, e.g. -i (ignore case) -r (recursive),\u003c/li\u003e\n    \u003cli\u003eyou can use longer arguments, e.g.: --icase, --resursive,\u003c/li\u003e\n    \u003cli\u003especifying the value of the argument: -d '/Users' or -d='/Users' or --dir '/Users' lub --dir='/Users',\u003c/li\u003e\n    \u003cli\u003eif you have several arguments without values (-i and -r) you can combine them: -ir\u003c/li\u003e\n    \u003cli\u003ethe text value of the argument may contain spaces: \u003cb\u003e-t=\u003c/b\u003e\u003ci\u003e'ala ma kota'\u003c/i\u003e or \u003cb\u003e--text\u003c/b\u003e \u003ci\u003e'ala ma kota'\u003c/i\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n## dependencies:\n### fmt library\n\u003col\u003e\n    \u003cli\u003efrom https://github.com/fmtlib/fmt\u003c/li\u003e\n    \u003cli\u003einstall on macOS: brew install fmt\u003c/li\u003e\n\u003c/ol\u003e\n\n## How to add to your own project (using CMake):\u003cbr\u003e\n\u003col\u003e\n    \u003cli\u003eGo to the root directory of your project (I assume you have git initialized).\u003c/li\u003e\n    \u003cli\u003eEnter the command: \u003cb\u003e\u003ci\u003egit submodule add https://github.com/piotrpsz/clap.git\u003c/i\u003e\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003eIn your project's \u003cb\u003eCMakeLists.txt\u003c/b\u003e file, add the following:\u003c/li\u003e\n    \u003cul\u003e\n        \u003cli\u003eadd_subdirectory(clap)\u003c/li\u003e\n        \u003cli\u003etarget_link_libraries(your_project_name PUBLIC clap)\u003c/li\u003e\n    \u003c/ul\u003e\n\u003c/ol\u003e\n\n## Example of use:\nFirst create a Clap object with the parameters you want:\n```c++\nauto clap = Clap(\"dirscanner v. 0.1\",\n                 Arg()\n                    .marker(\"-i\")\n                    .promarker(\"--icase\")\n                    .ordef(false),\n                 Arg()\n                    .marker(\"-r\")\n                    .promarker(\"--recursive\"),\n                 Arg()\n                    .marker(\"-d\")\n                    .promarker(\"--dir\")\n);\n```\nThen, after the program starts, call the \u003cb\u003eparse\u003c/b\u003e function::\n```c++\nint main(int argn, char* argv[]) {\n    clap.parse(argn, argv);\n    ...\n    ...\n}\n```\nAnd finally to get the parsing result:\n```c++\n    if (auto directory = clap[\"--dir\"]; directory)\n        std::cout \u003c\u003c *directory \u003c\u003c '\\n';\n\n    if (auto icase = clap[\"-i\"]; icase)\n        std::cout \u003c\u003c *icase \u003c\u003c '\\n';\n```\nWhen no value is given for the argument, it receives the logical value true (that it was in the call).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrpsz%2Fclap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiotrpsz%2Fclap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrpsz%2Fclap/lists"}