{"id":24401631,"url":"https://github.com/manered/inscript","last_synced_at":"2026-02-26T16:54:34.347Z","repository":{"id":270973758,"uuid":"907394997","full_name":"Manered/Inscript","owner":"Manered","description":"A simple, easy configuration file library that supports multiple formats.","archived":false,"fork":false,"pushed_at":"2025-03-08T09:25:54.000Z","size":130,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-29T05:52:40.499Z","etag":null,"topics":["config","configs","configurate","configuration","configuration-files","datascript","datascript-parser","inscript","minecraft","yaml","yaml-parser","yml","yml-parser"],"latest_commit_sha":null,"homepage":"","language":"Java","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/Manered.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-23T13:36:30.000Z","updated_at":"2025-03-08T09:25:44.000Z","dependencies_parsed_at":"2025-03-01T23:28:58.170Z","dependency_job_id":null,"html_url":"https://github.com/Manered/Inscript","commit_stats":null,"previous_names":["manered/inscript"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Manered/Inscript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manered%2FInscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manered%2FInscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manered%2FInscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manered%2FInscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Manered","download_url":"https://codeload.github.com/Manered/Inscript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manered%2FInscript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28550463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T20:59:07.572Z","status":"ssl_error","status_checked_at":"2026-01-18T20:59:02.799Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["config","configs","configurate","configuration","configuration-files","datascript","datascript-parser","inscript","minecraft","yaml","yaml-parser","yml","yml-parser"],"created_at":"2025-01-20T00:32:39.356Z","updated_at":"2026-01-18T21:00:37.776Z","avatar_url":"https://github.com/Manered.png","language":"Java","readme":"# Inscript\nA simple, easy configuration file library that supports multiple formats.\n---\n## Default Data Types:\n| Data Type  | Java                 | Usage Example                                |\n|------------|----------------------|----------------------------------------------|\n| String     | String               | `'Hello'`, `\"Hello\"`, `Hello`                |\n| Boolean    | Boolean              | `True`, `False`, `true`, `false`             |\n| Byte       | Byte                 | `13B`                                        |\n| Short      | Short                | `255S`                                       |\n| Integer    | Integer              | `100`                                        |\n| Double     | Double               | `10.5D`                                      |\n| Float      | Float                | `10.00F`                                     |\n| Long       | Long                 | `100000L`                                    |\n| Character  | Character            | `'A'C`                                       |\n| UUID       | UUID                 | `uuid(4ad4c78c-d4a4-4d25-91cf-4f001efc46c0)` |\n| Byte Array | byte[] (Uses Base64) | `base64(base64ValueHere...)`                 |\n---\n## Custom Data Types\nYou can register your own data types and also a custom section parser\nAccess the ValueRegistry with:\n```java\nfinal ValueRegistry registry = ValueRegistry.REGISTRY;\n```\nAfter that, we can register a simple data type:\n```java\nregistry.register(BigDecimal.class, InlineValue.\u003cBigDecimal\u003ebuilder()\n  .matches(text -\u003e {\n    if (!text.startsWith(\"bigDecimal(\") \u0026\u0026 !text.endsWith(\")\")) return false;\n\n    try {\n      new BigDecimal(text.substring(11, text.length() - 1);\n      return true;\n    } catch (final Exception e) {\n      return false;\n    }\n  })\n  .deserialize(text -\u003e {\n    if (!text.startsWith(\"bigDecimal(\") \u0026\u0026 !text.endsWith(\")\")) return null;\n    return new BigDecimal(text.substring(11, text.length() - 1));\n  })\n  .serialize(bigDecimal -\u003e \"bigDecimal(\" + bigDecimal.toString() + \")\")\n  .build()\n);\n```\nYou can also make a simple Ticket section or whatever if you like storing stuff without repeating code.\n```java\npublic record Ticket(@NotNull UUID user, long date) {}\n\nregistry.register(Ticket.class, InscriptValue.\u003cTicket\u003ebuilder()\n  .serialize((ticket, section) -\u003e {\n    section.set(\"user\", ticket.user());\n    section.set(\"date\", ticket.date());\n  })\n  .deserialize(section -\u003e {\n    final Optional\u003cUUID\u003e user = section.get(\"user\", UUID.class);\n    final Optional\u003cLong\u003e date = section.get(\"date\", Long.class);\n\n    if (user.isEmpty() || date.isEmpty()) return null;\n    return new Ticket(user.get(), date.get());\n  })\n  .build()\n);\n```\nAnd we're done!\n---\n## Inscript Constants\nIf you want to change the default indent or the root section node key you can do that easily.\n```java\nInscriptConstants.INDENT.set(\"    \"::repeat);\nInscriptConstants.ROOT_SECTION_KEY.set(\"*\");\n\nInscriptConstants.VERSION.get().get().ifPresent((version) -\u003e {\n    System.out.println(\"Running Inscript version `\" + version + \"`\");\n});\n```\n---\n## Using Inscript\n**By default, we offer 2 file format implementations:**\n1. YAML/YML (.yml) `FileFormats.YAML`\n2. DataScript (.ds) `FileFormats.DATASCRIPT`\n\nInscript doesn't actually need a file to work. You can use it perfectly fine with just strings.\n\n### Getting a new Inscript instance:\n```java\n// Auto-detect the file format from the file's extension\nfinal Inscript autoDetect = Inscript.newInscript(Path.of(\"file.yml\"));\n\n// Manually provide a file format\nfinal Inscript manual = Inscript.newInscript(FileFormats.DATASCRIPT, Path.of(\"file.ds\"));\n\n// Can't use file I/O features, must use saveToString and loadFromString. You must specify the file format.\nfinal Inscript empty = Inscript.newInscript(FileFormats.YAML);\n```\n### Saving and Loading\nNow, the function you should call depends on the source.\nIf you haven't specified a Path or File in Inscript#newInscript, that means that you can't use `loadFromDisk()` and `saveToDisk()`.\n```java\nfinal Inscript inscript = /* ... */;\n\n// Only use if you are sure you provided a path to Inscript.newInscript()\ninscript.loadFromDisk();\n```\n### Node Editor\nThere are 3 node implementations:\n1. `ScalarNode` - a mapping of a key to a value.\n2. `SectionNode` - holds a bunch of children nodes.\n3. `RootSectionNode` - a default implementation of SectionNode with a specific root key and an empty modifiable list of children nodes.\n\nEvery editor is a `SectionNode` wrapped in a **`ConfigSection`**\nA ConfigSection is a chainable/fluent builder interface that has the following methods:\n```java\n@NotNull\n@Unmodifiable\nSet\u003cConfigNode\u003e getChildren();\n    \n@NotNull\n@Unmodifiable\nSet\u003cString\u003e getKeys();\n\nboolean isRoot();\n\n@NotNull\nOptional\u003cConfigNode\u003e getNode(final @NotNull String key);\n\nboolean isSection(final @NotNull String key);\n\nboolean isScalar(final @NotNull String key);\n\n@NotNull\nSectionNode getSection();\n\n@NotNull\nOptional\u003cConfigSection\u003e getSection(final @NotNull String key);\n\n@NotNull\nConfigSection createSection(final @NotNull String key);\n\n@NotNull\n@CanIgnoreReturnValue\nConfigSection section(final @NotNull String key, final @NotNull Consumer\u003cConfigSection\u003e handler);\n\n@NotNull\n\u003cT\u003e Optional\u003cT\u003e get(final @NotNull String key, final @NotNull Class\u003c? extends T\u003e ignoredType);\n\n@NotNull\n\u003cT\u003e List\u003cT\u003e getList(final @NotNull String key, final @NotNull Class\u003c? extends T\u003e ignoredType);\n\n@NotNull\n@CanIgnoreReturnValue\n\u003cT\u003e ConfigSection set(final @NotNull String key, final @Nullable T value);\n\nboolean has(final @NotNull String key);\n\nboolean contains(final @NotNull String key);\n\n@NotNull\n@CanIgnoreReturnValue\nConfigSection unset(final @NotNull String key);\n\n@NotNull\n@CanIgnoreReturnValue\nConfigSection reset();\n\n@NotNull\n@CanIgnoreReturnValue\nConfigSection forEachSection(final @NotNull Consumer\u003cConfigSection\u003e sectionConsumer);\n\n@NotNull \n@CanIgnoreReturnValue\nConfigSection forEachScalar(final @NotNull Consumer\u003cScalarNode\u003c?\u003e\u003e scalarConsumer);\n\n@NotNull\n@CanIgnoreReturnValue \nConfigSection forEach(final @NotNull Consumer\u003cScalarNode\u003c?\u003e\u003e scalarConsumer, final @NotNull Consumer\u003cConfigSection\u003e sectionConsumer);\n\n@NotNull\n@CanIgnoreReturnValue\nConfigSection comment(final @NotNull String key, final @NotNull Collection\u003c? extends String\u003e comments);\n\n@NotNull\nCollection\u003cString\u003e getComments(final @NotNull String key);\n\n@NotNull\n@CanIgnoreReturnValue \nConfigSection comment(final @NotNull String key, final @NotNull String @NotNull ... comments);\n```\nTo access the root section editor, you can use:\n```java\nfinal Inscript inscript = /* ... */;\nfinal ConfigSection root = inscript.getRoot();\n```\n\n### Miscellaneous\nBy default, Inscript does not run anything asynchronously for you.\n\n\u003e [!Caution]\n\u003e \n\u003e Any loading and saving operations from Inscript **should be run asynchronously**.\n\u003e \n\u003e Make sure to run the string based methods (not the disk ones) asynchronously as well.\n\u003e They are basically the same as the disk based ones without the file writing and reading.\n\u003e\n\u003e **Example:**\n\u003e ```java\n\u003e CompletableFuture.runAsync(inscript::loadFromDisk).thenRun(() -\u003e {\n\u003e     // ...\n\u003e });\n\u003e ```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanered%2Finscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanered%2Finscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanered%2Finscript/lists"}