{"id":15510384,"url":"https://github.com/ananace/habari","last_synced_at":"2026-05-13T01:34:25.597Z","repository":{"id":27361103,"uuid":"30836479","full_name":"ananace/Habari","owner":"ananace","description":"A C++11 commandline/environment parser for program options","archived":false,"fork":false,"pushed_at":"2015-02-16T14:58:36.000Z","size":196,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T05:12:12.422Z","etag":null,"topics":[],"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/ananace.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}},"created_at":"2015-02-15T18:13:47.000Z","updated_at":"2015-02-16T14:58:36.000Z","dependencies_parsed_at":"2022-09-02T07:22:54.401Z","dependency_job_id":null,"html_url":"https://github.com/ananace/Habari","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ananace/Habari","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ananace%2FHabari","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ananace%2FHabari/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ananace%2FHabari/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ananace%2FHabari/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ananace","download_url":"https://codeload.github.com/ananace/Habari/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ananace%2FHabari/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32964052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"ssl_error","status_checked_at":"2026-05-12T23:30:18.191Z","response_time":102,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-10-02T09:48:11.542Z","updated_at":"2026-05-13T01:34:25.575Z","avatar_url":"https://github.com/ananace.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Habari\n======\n\nA C++11 commandline/config/environment parser for program options.\nLicensed under the MIT license, more information in the LICENSE file.\n\nMockup\n======\n\n```c++\n#include \u003cHabari/Defines.hpp\u003e\n#include \u003cHabari/Flag.hpp\u003e\n#include \u003cHabari/MultiFlag.hpp\u003e\n#include \u003cHabari/Parameter.hpp\u003e\n#include \u003ciostream\u003e\n\nHABARI_BEGIN_PARAMETERS\n\nHABARI_FLAG(Help, \"Prints the usage and exits\")\n\tHABARI_SHORTHAND('h')\nHABARI_END(Help)\n\nHABARI_FLAG(Version, \"Prints the version of the compiled software and exits.\")\n\tHABARI_SHORTHAND('V')\nHABARI_END(Version)\n \nHABARI_MULTIFLAG(Verbose, \"Enable verbose output\")\n\tHABARI_SHORTHAND('v')\n\tHABARI_ENVIRONMENT(VERBOSE)\n\t// Only allow stacking up to -vvvv\n\tHABARI_VERIFIER([](unsigned int newVal) -\u003e bool { return newVal \u003c 5; })\n\t// 'Warning' level by default\n\tHABARI_DEFAULT(2)\n\t// Defaults to the parameter name, uppercased\n\tHABARI_VALUENAME(LEVEL)\nHABARI_END(Verbose)\n \nHABARI_FLAG(Fullscreen, \"Run the program fullscreened\")\n\tHABARI_SHORTHAND('f')\n\tHABARI_CATEGORY(Window)\nHABARI_END(Fullscreen)\n \nHABARI_PARAMETER(Size, std::string, \"Specify the size of the window\")\n\tHabari_ALIASES(\"Geometry\", \"Geom\")\n\tHABARI_CATEGORY(Window)\n\tHABARI_SHORTHAND('s', 'g')\n\t// Verify that it's a valid resolution\n\tHABARI_VERIFIER([](const std::string\u0026 input) -\u003e bool { int x, y; return (sscanf(input.c_str(), \"%dx%d\", \u0026x, \u0026y) == 2 \u0026\u0026 x \u003e 0 \u0026\u0026 y \u003e 0); })\n\tHABARI_DEFAULT(\"1024x768\")\nHABARI_END(Size)\n \nHABARI_PARAMETER(FPS, uint32_t, \"FPS limit, specify 0 for no limit\")\n\tHABARI_CATEGORY(Window)\n\tHABARI_DEFAULT(60)\nHABARI_END(FPS)\n\nHABARI_FLAG(Quit, \"Quits the program immediately\")\nHABARI_END(Quit)\n\nHABARI_END_PARAMETERS\n\nenum Verbosity {\n\tFatal = 0,\n\tError,\n\tWarning,\n\tInfo,\n\tDebug\n};\n\nint main(int argc, char** argv)\n{\n\tHabari::ParseEnvironment();\n\tint unparsed = Habari::ParseCommandline(argc, argv);\n\n\tif (Habari::HasErrors())\n\t{\n\t\tHabari::PrintErrors();\n\t\tstd::cout \u003c\u003c \"Use --help for usage.\" \u003c\u003c std::endl;\n\t\treturn 1;\n\t}\n\n\tif (Habari::Params::Help.get() || unparsed == 0)\n\t{\n\t\tHabari::PrintUsage(\"\u003cinput file\u003e\");\n\t\tstd::cout \u003c\u003c \"Also, this example is just a very basic mockup of the final system.\" \u003c\u003c std::endl;\n\t\treturn 0;\n\t}\n\n\t// Direct variable access\n\tif (Habari::Params::Version.get())\n\t{\n\t\tstd::cout \u003c\u003c \"Version 0.0.0.1\" \u003c\u003c std::endl;\n\t\treturn 0;\n\t}\n\n\tstd::cout \u003c\u003c \"Launching application in \" \u003c\u003c Habari::Params::Size.get() \u003c\u003c (Habari::Params::Fullscreen.get() ? \" fullscreen\" : \" windowed\") \u003c\u003c \" mode.\" \u003c\u003c std::endl;\n\n\t// Parameter lookup\n\tif (Habari::GetMultiflag(\"Verbose\").get() \u003e= Info)\n\t\tstd::cout \u003c\u003c \"FPS will be limited to \" \u003c\u003c Habari::GetParameter\u003cuint32_t\u003e(\"FPS\").get() \u003c\u003c \" frames per second.\" \u003c\u003c std::endl;\n\n\treturn 0;\n}\n```\n\n```\n$ ./a.out\nLaunching application in 1024x768 windowed mode.\n$ ./a.out -fs 640x480 --fps=10\nLaunching application in 640x480 fullscreen mode.\n$ ./a.out -fv --size 640x480 # Long options don't need to use '='\nLaunching application in 640x480 fullscreen mode.\nFPS will be limited to 60 frames per second.\n$ VERBOSE=4 ./a.out --fullscreen --verbose=0 # Commandline has higher priority than environment variables\nLaunching application in 1024x768 fullscreen mode.\n$ ./a.out -fs\nError, missing value for parameter Size ('s')\nUse --help for usage.\n$ ./a.out --size=1024\nError, invalid value '1024' specified for parameter Size\nUse --help for usage.\n$ ./a.out -h\nUsage: a.out [options] \u003cinput file\u003e\n\nGeneral Options:\n  -h, --help    Prints the usage and exits\n  -V, --version Prints the version of the compiled software and exits.\n  -v, --verbose[=LEVEL]\n\t\t\t\tEnable verbose output\n  --quit        Quits the program immediately\n\nWindow Options:\n  --fullscreen  Run the program fullscreened\n  -g SIZE, -s SIZE, --geom=SIZE, --geometry=SIZE, --size=SIZE\n\t\t\t\tSpecify the size of the window\n  --fps=FPS     FPS limit, specify 0 for no limit\n\nAlso, this example is just a very basic mockup of the final system.\n\n$\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fananace%2Fhabari","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fananace%2Fhabari","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fananace%2Fhabari/lists"}