{"id":31935321,"url":"https://github.com/yisusgaming/term","last_synced_at":"2025-10-14T07:00:26.021Z","repository":{"id":182962094,"uuid":"560176464","full_name":"YisusGaming/term","owner":"YisusGaming","description":"Term is a library that provides ways to read data from text files and convert it for use in CSharp.","archived":false,"fork":false,"pushed_at":"2023-08-09T17:00:17.000Z","size":261,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-09T17:37:37.332Z","etag":null,"topics":["config","csharp","csharp-library","interpreter","interpreters","library","new-release","plain-text","plaintext","release","term","termconfig","text"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YisusGaming.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}},"created_at":"2022-10-31T22:38:30.000Z","updated_at":"2022-10-31T23:34:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"a543b0fa-477b-4b41-a91b-0a29b467ac71","html_url":"https://github.com/YisusGaming/term","commit_stats":null,"previous_names":["yisusgaming/term"],"tags_count":2,"template":null,"template_full_name":null,"purl":"pkg:github/YisusGaming/term","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusGaming%2Fterm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusGaming%2Fterm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusGaming%2Fterm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusGaming%2Fterm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YisusGaming","download_url":"https://codeload.github.com/YisusGaming/term/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusGaming%2Fterm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018138,"owners_count":26086285,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","csharp","csharp-library","interpreter","interpreters","library","new-release","plain-text","plaintext","release","term","termconfig","text"],"created_at":"2025-10-14T07:00:01.448Z","updated_at":"2025-10-14T07:00:26.009Z","avatar_url":"https://github.com/YisusGaming.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![build](https://github.com/YisusGaming/term/actions/workflows/integrate.yml/badge.svg)](https://github.com/YisusGaming/term/actions/workflows/integrate.yml)\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg style=\"\" src=\"./assets/Term.png\" alt=\"TERM\" height=\"150\"\u003e\u003c/img\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ch3\u003eSave configs in text files and use them in C#!\u003c/h3\u003e\n\u003c/div\u003e\n\n**Term** is a simple interpreter that can convert key-value pairs defined in text to C# dictionaries.\n\n***You can find here:***\n- [Setup](#1-setup)\n- [Docs](#docs)\n- [Term's Syntax](#syntax)\n- [Features coming soon](#coming-soon)\n- [License](#license)\n\n----------\n\n\u003ch1 align=\"center\"\u003eGetting Started\u003c/h1\u003e\n\n\u003e \u003c!\u003e This guide assumes that your project contains a csproj file.\n## 1. Setup\n\n\u003cspan style=\"font-size: 1.4rem;\"\u003e**First**\u003c/span\u003e, you have to download the `Term.zip` zip file from the **latest** release.\nOnce it's downloaded, unzip it.\n\n\u003e There's also another method you could use, see it [here](https://github.com/YisusGaming/term/wiki#getting-started).\n\nOnce you have the unzipped folder, place it inside your project.\n\n\u003cspan style=\"font-size: 1.4rem;\"\u003e**Next**\u003c/span\u003e, you have to add a **reference** to the file `(Term.dll)`.\n\nTo do that, add this to your `csproj`:\n```xml\n\u003cItemGroup\u003e\n    \u003cReference Include=\"Term\"\u003e\n        \u003cHintPath\u003ePATH/TO/TERM.dll\u003c/HintPath\u003e\n    \u003c/Reference\u003e\n\u003c/ItemGroup\u003e\n```\n\u003e \u003c!\u003e Replace \"PATH/TO/TERM.dll\" with the path where the `dll` is in your project.\n\n\u003e \u003c!\u003e If you're using **Visual Studio**, you can add the reference via **Visual Studio's GUI**.\n\nThat's it! You've successfully finished the setup. Continue in the [docs](#docs).\n\n\u003e Any problems during the setup? **Check the setup guide again**. Still have problems? Post an **issue** so I can help you!\n\n----------\n\n\u003ch1 id=\"docs\" align=\"center\" id=\"docs\"\u003eDocs\u003c/h1\u003e\n\nJump to the [example](#example).\n\n## Namespaces\n```csharp\nnamespace Term;\n```\n----------\n\n## Classes\n```csharp\nnamespace Term;\n\npublic static class TermInterpreter { }\n```\nThe interpreter itself.\n\n\u003cspan style=\"font-size: 1.2rem;\"\u003e**Methods**\u003c/span\u003e:\n\n1. ```csharp\n    public static Dictionary\u003cstring, string\u003e Interpret(string path)\n    ```\n    The Interpreter's method. `This` method reads a `Term` file located at a specified path and `returns` a `Dictionary` containing the keys and values that were found.\n\n   1. ### Parameters:\n      1. `path`\u003cbr\u003e**Type**: `string`\u003cbr\u003eDescription: The absolute path to the file that will be interpreted.\n   2. ### Returns\n        ```csharp\n        new Dictionary\u003cstring, string\u003e\n        ```\n        A dictionary containing the keys and values that were found in the file.\n\n\u003cbr/\u003e\u003cbr/\u003e\n\n2. ```csharp\n    public static void WriteToFile(string path, Dictionary\u003cstring, string\u003e  termContent, bool replaceContent = true)\n    ```\n    Writes a `dictionary` into a term file.\n\n    It automatically generates `Term configs`\n    based on the dictionary provided.\n\n    The method will also format correctly any key in\n    the dictionary.\n    So if the dictionary contains a key named\n    \"`My Key`\" it will be formatted to \n    \"`my_key`\" before writing\n    it to the file.\n\n    1. ### Parameters:\n       1. `path`\u003cbr/\u003e**Type**: `string`\u003cbr/\u003eDescription: The absolute path to the term file to write into.\n       2. `termContent`\u003cbr/\u003e**Type**: `Dictionary\u003cstring, string\u003e`\u003cbr/\u003eDescription: The content that will be written in the file.\n       3. `replaceContent`\u003cbr/\u003e**Type**: `bool`\u003cbr/\u003eDescription: If `true`, replace all the contents in the term file.\u003cbr/\u003e\u003cbr/\u003e if `false`, append all the contents to the end of the file with a comment \"`# Written from C#:`\".\u003cbr/\u003e\u003cbr/\u003eThis parameter is optional. Defaults to `true`.\n    \n\n----------\n\n\u003ch1 id=\"syntax\" align=\"center\"\u003eTerm's syntax\u003c/h1\u003e\n\n1. ### Comments\n   Comments in `Term` are really simple.\n   \n   Every line starting with a `#` it's a comment and it's going to be ignored by the `Interpreter`.\n   \n   Example:\n   ```term\n   # This is a comment\n   ```\n\n2. ### Configs\n   **Configs** are made of **key-value** pairs.\n\n   A `config` is how we call these key-value pairs in `Term`.\n\n   The key is separated from the value by this symbol: `-\u003e`\n\n   Example:\n   ```term\n   my_key -\u003e My value\n   ```\n\n   It's important that these `configs` are declared on a **single line**, otherwise it can cause errors.\n\n### Important aspects:\n   1. Any empty line found in the `Term` file is going to be ignored by the `Interpreter`.\n   2. The keys should be named using `snake_case`.\n   3. `string` values don't need to be surrounded by `\"\"`.\n\n----------\n\n## Example\n\nLet's code a simple example using `Term`.\n\nAssuming we already created a dotnet project and we did the [setup](#1-setup)...\n\n\u003cdiv id=\"configs-here\"\u003e\u003c/div\u003e\n\n**First**, let's start by creating our `Term` file and writing some configs:\n```term\n# Epic configs going here\n\n# Window\nwindow_title -\u003e My Window\nwindow_color -\u003e LIMEGREEN\n\n# User\nusername -\u003e YisusGaming\nepic_stuff -\u003e Yes it's epic\n```\nNow, let's save this file, in my case, I'm saving the `Term` file next to my `Program.cs` file.\n\n\u003cdiv id=\"file-structure\"\u003e\u003c/div\u003e\n\nThe **file structure** is something like this:\n```\nProject Folder\n    | Program.cs\n    | Term.dll\n    | test.term\n    | project.csproj\n```\n\u003e Note: `test.term` is the name I gave to the file.\n\nOk, let's go into the `Program.cs`.\n\nFirst, we have to make sure the `Term` namespace is being use in the `C#` file:\n```csharp\nusing Term;\n```\n\nThat way, we can use the `Interpret` method from the `TermInterpreter` class.\n\nNow, the `Interpret` method needs one argument: The `path` to the file that will be interpreted. In order to give it the path, we can use the `Path.GetFullPath()` method included in `C#`.\n\nIn my case, It will be something like this:\n```csharp\nstring path = Path.GetFullPath(\"test.term\");\n```\n\u003e Note: This is inside of `C#`'s `Main` method.\n\nWe call `Path.GetFullPath` and we pass in the path to our `Term` file, relative to the project's folder.\n\u003e \u003c!\u003e Remember: The file structure in this example is like [this](#file-structure).\n\nNow that we got the `Term`'s file path, we can call `TermInterpreter.Interpret` and give it the path!\n\n```csharp\nDictionary\u003cstring, string\u003e load = TermInterpreter.Interpret(path);\n```\n\n\u003e Notice that, I'm creating a variable called `load` to store the `Dictionary` that this method returns.\n\nAnd we're done! The `Interpret` method does everything for us and returns a `Dictionary` with the keys and values in our term file!\n\nThat means: Now we can access these values using the keys.\n\nFor example: We can now access the config we created [before](#configs-here) called `window_title` and print the value in console:\n```csharp\nConsole.WriteLine(load[\"window_title\"]);\n```\n\u003e \u003c!\u003e Remember: `load` was the name I give to my `Dictionary` with all the keys and values.\n\nAnd should print us the value of `window_title`!\n\nFull code of the Example:\n```csharp\nusing System;\nusing System.Collections.Generic;\nusing Term;\n\nnamespace MyProgram\n{\n    class Program\n    {\n        public static void Main(string[] args)\n        {\n            string path = Path.GetFullPath(\"test.term\"); // Get the full path from a path relative to our project's folder\n            Dictionary\u003cstring, string\u003e load = TermInterpreter.Interpret(path); // Interpret the file\n            Console.WriteLine(load[\"window_title\"]); // Should print the value!\n        }\n    }\n}\n```\n## Important notes\n1. You may get errors by trying to accessing a keys that isn't in the returned dictionary. This can happen for reasons like the key being not defined at the term file.\n\n    You can manage these errors as you want.\n\n\u003e Any problems during the example? **Check the example again**. Still have problems? Post an **issue** so I can help you!\n\n----------\n\n\u003ch1 id=\"coming-soon\" align=\"center\"\u003eComing soon\u003c/h1\u003e\n\n1. Arithmetic operations in `Term` values.\n\n----------\n\n\u003ch1 id=\"license\" align=\"center\"\u003eLicense\u003c/h1\u003e\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-nd/4.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png\" /\u003e\u003c/a\u003e\u003cbr /\u003e\u003cspan xmlns:dct=\"http://purl.org/dc/terms/\" property=\"dct:title\"\u003eTerm\u003c/span\u003e by \u003cspan xmlns:cc=\"http://creativecommons.org/ns#\" property=\"cc:attributionName\"\u003eYisusGaming\u003c/span\u003e is licensed under a \u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-nd/4.0/\"\u003eCreative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyisusgaming%2Fterm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyisusgaming%2Fterm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyisusgaming%2Fterm/lists"}