{"id":28205867,"url":"https://github.com/aetopia/cfgparser","last_synced_at":"2025-06-11T11:31:54.023Z","repository":{"id":65393748,"uuid":"591578681","full_name":"Aetopia/CfgParser","owner":"Aetopia","description":"An alternative `parsecfg` configuration parser for Nim.","archived":false,"fork":false,"pushed_at":"2023-01-28T12:27:43.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T10:08:38.344Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Nim","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/Aetopia.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":"2023-01-21T06:35:54.000Z","updated_at":"2023-05-16T23:38:01.000Z","dependencies_parsed_at":"2023-02-12T08:15:51.261Z","dependency_job_id":null,"html_url":"https://github.com/Aetopia/CfgParser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aetopia%2FCfgParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aetopia%2FCfgParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aetopia%2FCfgParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aetopia%2FCfgParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aetopia","download_url":"https://codeload.github.com/Aetopia/CfgParser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aetopia%2FCfgParser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259255511,"owners_count":22829484,"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":[],"created_at":"2025-05-17T10:08:38.033Z","updated_at":"2025-06-11T11:31:53.990Z","avatar_url":"https://github.com/Aetopia.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CfgParser\nAn alternative `parsecfg` configuration parser for Nim.\n\n## Aim\nAim of this project is the following:\n\n1. Resolve unintended interpretation of configuration files.   \n    `parsecfg` sometimes doesn't parse key-value pairs correctly depending on how the key and value are represented in the file.\n\n    Example:  \n    **Key Value Pair**\n    ```ini\n    NamedCounts=((\"DiscoveryLobbyMatchmakingPlay\", 23),(\"DiscoveryLobbyMatchmakingPlay_HotfixVer\", 0),(\"lastfrontendflow_Fortnite\", 23),(\"lastfrontendflow_Fortnite_HotfixVer\", 0),(\"UEnableMultiFactorModal::ShouldShowMFASplashScreen\", 23),(\"UEnableMultiFactorModal::ShouldShowMFASplashScreen_HotfixVer\", 0),(\"FrontendContext:ShouldShowSocialImport\", 23),(\"FrontendContext:ShouldShowSocialImport_HotfixVer\", 0))\n    ```\n\n    **What it is parsed as**\n    ```ini\n    namedcounts=\"\"\"((\"DiscoveryLobbyMatchmakingPlay\", 23),(\"DiscoveryLobbyMatchmakingPlay_HotfixVer\", 0),(\"lastfrontendflow_Fortnite\", 23),(\"lastfrontendflow_Fortnite_HotfixVer\", 0),(\"UEnableMultiFactorModal::ShouldShowMFASplashScreen\", 23),(\"UEnableMultiFactorModal::ShouldShowMFASplashScreen_HotfixVer\", 0),(\"FrontendContext:ShouldShowSocialImport\", 23),(\"FrontendContext:ShouldShowSocialImport_HotfixVer\", 0))\"\"\"\n    ```\n\n2. Implement customizable parsing arguments.\n3. Implement similar functions present in `parsecfg`.\n\n\n## Functions and Objects\n\n1. Configuration File Object.\n    ```nim\n    type Cfg* = OrderedTableRef[string, OrderedTableRef[string, string]]\n    ```\n    - Functions\n        1. ```nim\n            proc setSectionValue*(cfg: var Cfg, section, key, value: string)\n            ```   \n            Set the value of a key for the specified section.\n        \n        2. ```nim\n            proc delSection*(cfg: var Cfg, section: string)\n            ```\n            Delete the specified section.\n        \n        3. ```nim\n            proc delSectionKey*(cfg: var Cfg, section, key: string)\n            ```\n            Delete the specified key from a section.\n                  \n        4. ```nim\n            proc getSectionValue*(cfg: Cfg, section, key: string, default: string = \"\")\n            ```\n            Get the value of a key from the specified section.\n\n2. Create a new Configuration File Object.\n    ```nim\n    proc newCfg*: Cfg\n    ```\n\n3. Load a Configuration File Object using a string or file.\n\n    - String Representation\n\n        ```nim\n        proc loadCfg*(str: string, case_sensitive: bool = true, delimiter: char = '=', comments: openArray[char] = [';']): Cfg\n        ```\n        - `str`: String representation of the configuration file.\n        - `caseSensitive`: Whether keys and sections should be case_senstive.\n        - `delimiter`: The character used to separate keys from values.\n        - `comments`: A sequence of characters used to indicate comments.\n    \n    - Filename\n\n        ```nim\n        proc readCfg*(str: string, case_sensitive: bool = true, delimiter: char = '=', comments: openArray[char] = [';']): Cfg\n        ```\n        - `filename`: Name of the file to read from.\n        - `caseSensitive`: Whether keys and sections should be case_senstive.\n        - `delimiter`: The character used to separate keys from values.\n        - `comments`: A sequence of characters used to indicate comments.\n\n4. Dump/Write a Configuration File Object as a string or file.\n\n    - String Representation\n\n        ```nim\n        proc dumpCfg*(cfg: Cfg, delimiter: char = '='): string\n        ```\n        - `cfg`: Configuration File Object\n        - `delimiter`: The character used to separate keys from values.\n    \n    - File\n\n        ```nim\n        proc writeCfg*(cfg: Cfg, filename: string, delimiter: char = '=')\n        ```\n        - `cfg`: Configuration File Object\n        - `filename`: Name of the file write.\n        - `delimiter`: The character used to separate keys from values.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faetopia%2Fcfgparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faetopia%2Fcfgparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faetopia%2Fcfgparser/lists"}