{"id":23803201,"url":"https://github.com/mr-cheff/confy","last_synced_at":"2025-09-06T15:33:58.493Z","repository":{"id":237689416,"uuid":"795053680","full_name":"mr-cheff/Confy","owner":"mr-cheff","description":"💻 Configure projects effortlessly!","archived":false,"fork":false,"pushed_at":"2024-06-19T19:34:03.000Z","size":189,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-22T03:02:57.601Z","etag":null,"topics":["config","configuration","configuration-file","init"],"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/mr-cheff.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-02T13:46:39.000Z","updated_at":"2024-06-19T19:34:06.000Z","dependencies_parsed_at":"2024-05-28T00:23:52.156Z","dependency_job_id":"f61e5b28-b177-4ee2-8f74-5f038713ebaa","html_url":"https://github.com/mr-cheff/Confy","commit_stats":null,"previous_names":["mauro-balades/confy","mr-cheff/confy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-cheff%2FConfy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-cheff%2FConfy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-cheff%2FConfy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-cheff%2FConfy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mr-cheff","download_url":"https://codeload.github.com/mr-cheff/Confy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232133153,"owners_count":18477259,"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":["config","configuration","configuration-file","init"],"created_at":"2025-01-01T22:29:54.717Z","updated_at":"2025-01-01T22:29:55.184Z","avatar_url":"https://github.com/mr-cheff.png","language":"C++","readme":"\n\u003cimg src=\"assets/logo.png\" height=\"150\" align=\"left\"/\u003e\n\n**Confy**\nConfigure projects effortlessly! 💻\n\nThis a project configuration file parser and system originally created for the [Snowball Programming Language](https://github.com/snowball-lang)!\n\n[Issues](https://github.com/mauro-balades/confy/issues)\n\n## Features\n\n* Header only C++ library (bringing fast parsing times)\n* Statically types (with syntax previously defined by the project executor)\n* Enables efficient memory management through smart pointers\n* Cross-platform compatibility for versatile deployment\n* Comprehensive error handling for robust development\n\n## Show Me The Syntax!\n\n```c++\n  auto root = confy::Interface::create({\n    {\"project\", confy::Type::Object({\n        {\"name\", confy::Type::String},\n        {\"version\", confy::Type::String},\n        {\"authors\", confy::Type::Array(confy::Type::String)},\n        {\"description\", confy::Type::String},\n    })},\n  });\n\n  auto result = confy::parse_file(root, \"./project.confy\");\n  // { errors: {}, root: ... }\n```\n\nWill be able to parse:\n\n```conf\n# haha, you cant see me!\n\nproject {\n    name = \"MyLib\"\n    version = \"1.0.0\"\n    author = [\"Your Name\"]\n    description = \"A project created with Confy!\"\n}\n```\n\n# Data Types\n\n### Object\n\n* A set of values of values that can be accessed by name\n\n```c++\nTypes::Object({\n  {\"name\": Type},\n  ...\n});\n```\n\n```js\n  myObject {\n    name = type\n  }\n```\n\n### Array\n\n* A set of values with the same type that can contain an infinite ammount of elements (from 0 to infinity)\n\n```c++\nTypes::Array(Type);\n```\n\n```js\n  myArray = [\"Hello\", \"Adios\", \"Ñog\"]\n```\n\n### String\n\n* An array of characters (it's just a string) \n\n```c++\nTypes::String;\n```\n\n```js\n  myName = \"mauro!\"\n```\n\n### Number\n\n* A number from -inf to inf that can contain decimal places (represented as a double in the backend)\n\n```c++\nTypes::Number;\n```\n\n```js\n  myNumber = 25\n```\n\n## Utility Types\n\n* Utility types are used to validate the given data.\n* To enable the utility classes, define the `CONFY_USE_UTILS` macro before including `confy.hpp`\n* If the validation returns an error, it will be thrown and the parsing will fail\n\n### MinNumType\u003cint N1\u003e\n\n* A number that must be bigger than `N1`\n\n```c++\nMinNumType\u003c10\u003e::create();\n```\n\n```js\n  myNumber = 12\n```\n\n\n### MaxNumType\u003cint N1\u003e\n\n* A number that must be less than `N1`\n\n```c++\nMaxNumType\u003c10\u003e::create();\n```\n\n```js\n  myNumber 6\n```\n\n### RangeNumType\u003cint N1, int N2\u003e\n\n* A number that must be bigger than `N1`and less than `N2`\n\n```c++\nRangeNumType\u003c10, 20\u003e::create();\n```\n\n```js\n  myNumber = 12\n```\n\n### MinStrType\u003cint S1\u003e\n\n* The parsed string's length must be bigger than `S1`\n\n```c++\nMinStrType\u003c3\u003e::create();\n```\n\n```js\n  myString = \"hello there\"\n```\n\n### StrRegexType\n\n* The parsed string's must satisfy the given regex\n\n```c++\nStrRegexType::create(\"*\");\n```\n\n```js\n  myString = \"I dont know how regex works\"\n```\n\n### Custom Validation Types\n\n* To create your own validation type, create a new class inheriting from a `primitive type` (like `NumType` or `StringType`).\n* Override the `validate` method where it's value may depend from which type is being inherited from.\n\nExample of a class that only accepts if a string starts with \"hello\".\n\n```c++\nclass MyCustomType : public confy::StringType {\npublic:\n  // Validate takes a `double` if it inherits from `confy::NumType`!\n  std::optional\u003cstd::string\u003e validate(const std::string\u0026 value) const override {\n    if (s.rfind(\"hello\", 0) == 0) { \n      return std::nullopt;\n    }\n    return \"String must start with 'hello'!\";\n  }\n\n  // Optional but it's nice to have a generator function\n  static std::shared_ptr\u003cMyCustomType\u003e create() {\n    return std::make_shared\u003cMyCustomType\u003e();\n  }\n}\n```\n\nUsage\n\n```c++\n  {\"myStr\": MyCustomType::create()}\n```\n\nThis will work as (ignore the duplicate name error):\n\n```py\n  myStr = \"hello world\"\n\n  myStr = \"hello mauro\"\n\n  # error!\n  myStr = \"goodbye :(\"\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-cheff%2Fconfy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmr-cheff%2Fconfy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-cheff%2Fconfy/lists"}