{"id":26167511,"url":"https://github.com/raftlib/cmdargs","last_synced_at":"2025-08-25T00:41:10.422Z","repository":{"id":34397480,"uuid":"38325169","full_name":"RaftLib/cmdargs","owner":"RaftLib","description":null,"archived":false,"fork":false,"pushed_at":"2021-06-15T15:48:49.000Z","size":717,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T17:46:15.005Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RaftLib.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}},"created_at":"2015-06-30T18:11:25.000Z","updated_at":"2024-12-31T12:49:09.000Z","dependencies_parsed_at":"2022-09-14T06:01:40.591Z","dependency_job_id":null,"html_url":"https://github.com/RaftLib/cmdargs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RaftLib/cmdargs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaftLib%2Fcmdargs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaftLib%2Fcmdargs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaftLib%2Fcmdargs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaftLib%2Fcmdargs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RaftLib","download_url":"https://codeload.github.com/RaftLib/cmdargs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaftLib%2Fcmdargs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271985525,"owners_count":24854074,"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-24T02:00:11.135Z","response_time":111,"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":[],"created_at":"2025-03-11T17:38:12.575Z","updated_at":"2025-08-25T00:41:10.299Z","avatar_url":"https://github.com/RaftLib.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Command Args\n=====================\nSuper simple command arguments parser for C++.\nYeah, there are quite a few already in existence, but I made this for a \nparticular purpose, ended up using it quite a \nbit so it's worth it at this point to put it\nup on GitHub so I can download it from multiple\npoints.\n\n# Build Status\n\n[![Build Status](https://travis-ci.org/RaftLib/cmdargs.svg?branch=master)](https://travis-ci.org/RaftLib/cmdargs)\n\n# Notes\n\nThere are a few bugs here and there, notably \nthere are a few instances where there are\nnull arguments that I'd like to pass but\nit's easy enough to get around by adding\nan explicit boolean.  \n\n# Compiling is super simple\n\n```bash\nmkdir build\ncd build\ncmake ../cmdargs\nmake\nsudo make install\n```\n\n\nwhich installs all the\nlibrary code and header files in the appropriate\n/usr/local prefix. I've used on both OS X and Linux,\nI'll check to see if it works on Windows when I get a chance.\n\n## Simple Example\n\n```cpp\nCmdArgs  cmd( argv[ 0 ],\n              std::cout,\n              std::cerr );\n\nbool help( false );\n\ncmd.addOption( new Option\u003c bool \u003e( help,\n                                    \"-h\",\n                                    \"Print this message\",\n                                    false ) );\nbool printHeader( false );\ncmd.addOption( new Option\u003c bool \u003e( printHeader,\n                                    \"-header\",\n                                    \"Print the header and exit\" ) );\n\n\ncmd.addOption( new Option\u003c std::string \u003e( filename,\n                                          \"-f\",\n                                          \"Set the output file name\",\n                                          true /** make this arg mandatory **/ ) );\n\ncmd.addOption( new Option\u003c int64_t \u003e( length, \n                                      \"-l\",\n                                      \"Length of run\" ) );\ncmd.addOption( new Option\u003c int64_t \u003e( buff_size,\n                                      \"-b\",\n                                      \"Buffer size\" ) );\n\ncmd.addOption( new Option\u003c int64_t \u003e( repeat,\n                                      \"-r\",\n                                      \"Number of times to repeat simulation\" ) );\n\n/** give object command line **/\ncmd.processArgs( argc, argv );\n\n/** handle the user needing help **/\nif( help )\n{\n   cmd.printArgs();\n   exit( EXIT_SUCCESS );\n}\n/** \n * to check and see if all mandatory args are set, add this code\n * which will print all mandatory args that are missing.\n */\nif(! cmd.allMandatorySet() )\n{ \n   //exit since well, mandatory args missing\n   exit( EXIT_FAILURE );\n}\n```\n\nEnjoy, feel free to update, copy or fix as you feel the need to.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraftlib%2Fcmdargs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraftlib%2Fcmdargs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraftlib%2Fcmdargs/lists"}