{"id":15735240,"url":"https://github.com/rxn7/redflag","last_synced_at":"2025-07-16T12:07:18.542Z","repository":{"id":183348178,"uuid":"669986665","full_name":"rxn7/redflag","owner":"rxn7","description":"c99 library for CLI flag/option management","archived":false,"fork":false,"pushed_at":"2024-01-14T09:22:01.000Z","size":45,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T03:47:06.685Z","etag":null,"topics":["c99","cli","flags","library"],"latest_commit_sha":null,"homepage":"https://maciejniziolek.xyz/#/project/redflag","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/rxn7.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-24T03:32:50.000Z","updated_at":"2023-07-26T09:29:23.000Z","dependencies_parsed_at":"2024-01-14T10:57:16.119Z","dependency_job_id":null,"html_url":"https://github.com/rxn7/redflag","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"ee8b951027bdd29bb9c1b52ea59774e3c96eac30"},"previous_names":["rxn7/redflag"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rxn7/redflag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxn7%2Fredflag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxn7%2Fredflag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxn7%2Fredflag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxn7%2Fredflag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rxn7","download_url":"https://codeload.github.com/rxn7/redflag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxn7%2Fredflag/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265508338,"owners_count":23779126,"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":["c99","cli","flags","library"],"created_at":"2024-10-04T01:11:14.146Z","updated_at":"2025-07-16T12:07:18.518Z","avatar_url":"https://github.com/rxn7.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RedFlag\nstb-style **c99** library for handling flags in CLI applications.\n![screenshot](.github/example2.png)\n\n# Example\nSee ```example.c```\n\n# Usage\n- Include the library in your header files\n```C++\n#include \"redflag.h\"\n```\n- In **only one** source file include the library but declare **REDFLAG_IMPLEMENTATION** first.\n```C++\n#define REDFLAG_IMPLEMENTATION\n#include \"redflag.h\"\n```\n\n- Create and init a context instance\n```C++\nrf_context_t ctx;\nrf_init_context(\u0026ctx);\n```\n\n- Add options/flags\n```C++\nrf_flag_bool(ctx*, name, desc, default_value);\nrf_flag_int(ctx*, name, desc, default_value);\nrf_flag_float(ctx*, name, desc, default_value);\nrf_flag_str(ctx*, name, desc, default_value);\n// All of these functions return a rf_flag_t pointer that is owned by the context\n```\n\n- After you have declared all your options/flags you can parse them\n```C++\nrf_parse_flags(\u0026ctx, argc, argv);\n```\n\n- After you have parsed the options/flags you can check their values\n```C++\nrf_flag_t* flag = rf_flag_str(\u0026ctx, \"test\", \"this is a test value\", \"default value\");\nrf_parse_flags(\u0026ctx, argc, argv);\nconst char *value = flag-\u003evalue.as_str;\nprintf(\"Value: %s\\n\", value);\n```\n\n- Remember to free the allocated memory\n```C++\nrf_free_context(\u0026ctx);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frxn7%2Fredflag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frxn7%2Fredflag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frxn7%2Fredflag/lists"}