{"id":25014338,"url":"https://github.com/gregoryv/ingrid","last_synced_at":"2025-03-30T05:13:20.801Z","repository":{"id":196271884,"uuid":"695325536","full_name":"gregoryv/ingrid","owner":"gregoryv","description":".ini file parser","archived":false,"fork":false,"pushed_at":"2023-09-27T06:06:25.000Z","size":122,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T07:19:35.420Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"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/gregoryv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-22T21:28:26.000Z","updated_at":"2023-09-24T05:37:52.000Z","dependencies_parsed_at":"2023-09-24T15:11:38.472Z","dependency_job_id":null,"html_url":"https://github.com/gregoryv/ingrid","commit_stats":null,"previous_names":["gregoryv/dotini","gregoryv/ingrid"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fingrid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fingrid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fingrid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fingrid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregoryv","download_url":"https://codeload.github.com/gregoryv/ingrid/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246277360,"owners_count":20751549,"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-02-05T07:19:07.737Z","updated_at":"2025-03-30T05:13:20.780Z","avatar_url":"https://github.com/gregoryv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- GENERATED, DO NOT EDIT! See internal/updateReadme.go --\u003e\n \u003cimg src=\"./internal/banner.png\"\u003e\nPackage ingrid parses .ini files.\n\n## Quickstart\n\n\t$ go get -u github.com/gregoryv/ingrid\n\n## Features\n\nThe format is often used in .ini, .conf or .cfg files. This\nimplementation is focused on performance and comes with minor\nlimitations.\n\n  - comments start with # or ;\n  - values may be quoted using \", ` (backtick), or ' (single tick)\n  - sections start with [ and end with ]\n  - spaces before and after key, values are removed\n\n## Limitations\n\nCurrently the limitations for this implementation are\n\n  - no spaces in keys\n  - no comments after a key value pair\n  - no multiline values\n\n## Example\n\n    package ingrid_test\n    \n    import (\n    \t\"bufio\"\n    \t\"errors\"\n    \t\"fmt\"\n    \t\"strings\"\n    \n    \t\"github.com/gregoryv/ingrid\"\n    )\n    \n    func Example() {\n    \tinput := `# generic things\n    debug = false\n    # default for servers\n    bind= localhost:80\n    \n    [example]\n    text = \"escaped \\\"\"\n    hostname = \"example.com\"\n    more = 'single \"quoted\" string'\n    \n    [github]\n    hostname=github.com\n    bind=localhost:443\n    empty=\n    \n    # invalid lines\n    color\n    my name = john\n    [trouble\n    text='...\n    `\n    \tmapping := func(section, key, value, comment string, err error) {\n    \t\tswitch {\n    \t\tcase errors.Is(err, ingrid.ErrSyntax):\n    \t\t\tfmt.Printf(\"input line:%v\\n\", err)\n    \n    \t\tcase key != \"\":\n    \t\t\tfmt.Printf(\"%s%s=%s\\n\", prefix(section), key, value)\n    \t\t}\n    \t}\n    \tingrid.Map(mapping, bufio.NewScanner(strings.NewReader(input)))\n    \t// output:\n    \t// debug=false\n    \t// bind=localhost:80\n    \t// example.text=escaped \"\n    \t// example.hostname=example.com\n    \t// example.more=single \"quoted\" string\n    \t// github.hostname=github.com\n    \t// github.bind=localhost:443\n    \t// github.empty=\n    \t// input line:17 color SYNTAX ERROR: missing equal sign\n    \t// input line:18 my name = john SYNTAX ERROR: space not allowed in key\n    \t// input line:19 [trouble SYNTAX ERROR: missing right bracket\n    \t// input line:20 text='... SYNTAX ERROR: missing end quote\n    }\n    \n    // prefix returns section. if not empty.\n    func prefix(section string) string {\n    \tif len(section) == 0 {\n    \t\treturn \"\"\n    \t}\n    \treturn section + \".\"\n    }\n\n## Benchmark\n\n     goos: linux\n     goarch: amd64\n     pkg: github.com/gregoryv/ingrid\n     cpu: Intel(R) Xeon(R) E-2288G CPU @ 3.70GHz\n     Benchmark_Map-16  154855074     7.678 ns/op    0 B/op    0 allocs/op\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregoryv%2Fingrid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregoryv%2Fingrid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregoryv%2Fingrid/lists"}