{"id":23514441,"url":"https://github.com/Agentew04/CliToolkit","last_synced_at":"2025-08-28T08:31:21.269Z","repository":{"id":208115818,"uuid":"720849187","full_name":"Agentew04/CliToolkit","owner":"Agentew04","description":"A collection of tools to help the development of CLI and TUI tools","archived":false,"fork":false,"pushed_at":"2024-01-30T00:51:51.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-01-30T02:08:47.773Z","etag":null,"topics":[],"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/Agentew04.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,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-11-19T19:31:00.000Z","updated_at":"2023-11-28T23:51:23.000Z","dependencies_parsed_at":"2024-01-30T02:03:51.960Z","dependency_job_id":null,"html_url":"https://github.com/Agentew04/CliToolkit","commit_stats":null,"previous_names":["agentew04/clitoolkit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agentew04%2FCliToolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agentew04%2FCliToolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agentew04%2FCliToolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agentew04%2FCliToolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Agentew04","download_url":"https://codeload.github.com/Agentew04/CliToolkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231136568,"owners_count":18333333,"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":"2024-12-25T14:01:44.372Z","updated_at":"2024-12-25T14:02:05.710Z","avatar_url":"https://github.com/Agentew04.png","language":"C#","funding_links":[],"categories":["Contributors Welcome for those"],"sub_categories":["1. [ThisAssembly](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisAssembly) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category"],"readme":"# Cli.Toolkit\n\nThis project is mainly composed of a source generator that helps\nthe developer to create a command line interface for a .NET Core\napplication. It also contains many useful classes and methods.\n\n## CLI Helper\n\n### Installation\n\nThe package is available on NuGet [here](https://www.nuget.org/packages/Cli.Toolkit/).\n\n### Usage\n\nThe simplest program consists of a **partial** class with the `CLIProgram`\nattribute and a method with the `Command` attribute.\n\n```cs\nusing CliToolkit.Attributes;\n\n[CliProgram]\npublic partial class MyCliTool {\n    [DefaultCommand]\n    [Command]\n    public void Add(Config args) {\n        // your command here\n    }\n}\n```\n\nThe above code would be called like this:\n\n```sh\n$ myclitool add\n```\nor, as there is a command with the `DefaultCommand` attribute:\n```sh\n$ myclitool\n```\n\n\u003e **Note:** Only one method/command can have the `DefaultCommand` attribute.\n\n## Source Generators\n\nMany useful source generators are present, and automate the implementation\nof features, such as:\n* Builder Pattern\n* Lazy Singleton\n* Thread Safety for a field \n\n### Usage\n\nThe generators are located in the namespace `Cli.Toolkit.Generators` and\nthe attributes to trigger them are normally located in the namespace \n`Cli.Toolkit.Attributes`.\n\n```csharp\nusing Cli.Toolkit.Generators;\nusing Cli.Toolkit.Attributes;\n\n// partial modifier is required to use source generators\npublic partial class Program {\n    \n    // these fields are not required to be static,\n    // but is needed if used directly in the Main method(static)\n    \n    [Lazy]\n    private static Config? cfg; // Generates the Cfg property\n    \n    [ThreadSafe]\n    private static int _number = 5; // Generates the Number property\n    \n    public static void Main() {\n        // use them here\n        // ...\n    }\n}\n```\n\n```csharp\nusing Cli.Toolkit.Generators;\nusing Cli.Toolkit.Attributes;\n\n// annotating the class\n// both properties and fields are supported\n[Buildable]\npublic class Hamburger {\n    \n    public List\u003cstring\u003e Ingredients { get; set; } = new();\n    \n    public int price;\n}\n\n// using the new builder\nHamburger hamburger = new HamburgerBuilder()\n    .WithIngredients([ \"Bread\", \"Meat\", \"Cheese\" ])\n    .WithPrice(5)\n    .Build();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAgentew04%2FCliToolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAgentew04%2FCliToolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAgentew04%2FCliToolkit/lists"}