{"id":22816205,"url":"https://github.com/swellshinider/easyarguments","last_synced_at":"2025-03-30T22:41:18.034Z","repository":{"id":267010770,"uuid":"899550993","full_name":"Swellshinider/EasyArguments","owner":"Swellshinider","description":"EasyArguments is a lightweight library for managing and parsing input arguments in C# .NET projects.","archived":false,"fork":false,"pushed_at":"2025-02-07T23:10:22.000Z","size":313,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-08T00:19:02.274Z","etag":null,"topics":["argparser","arguments","csharp","csharp-library","library","net","open-source","parser"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Swellshinider.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-06T13:56:40.000Z","updated_at":"2025-02-06T18:35:11.000Z","dependencies_parsed_at":"2025-01-31T02:21:09.013Z","dependency_job_id":null,"html_url":"https://github.com/Swellshinider/EasyArguments","commit_stats":null,"previous_names":["swellshinider/easyarguments"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FEasyArguments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FEasyArguments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FEasyArguments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FEasyArguments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Swellshinider","download_url":"https://codeload.github.com/Swellshinider/EasyArguments/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390864,"owners_count":20769476,"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":["argparser","arguments","csharp","csharp-library","library","net","open-source","parser"],"created_at":"2024-12-12T14:06:51.300Z","updated_at":"2025-03-30T22:41:18.028Z","avatar_url":"https://github.com/Swellshinider.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# EasyArguments\n\n[![GitHub](https://img.shields.io/github/license/swellshinider/EasyArguments)](https://github.com/swellshinider/EasyArguments/blob/main/LICENSE) [![NuGet download count](https://img.shields.io/nuget/dt/EasyArguments)](https://www.nuget.org/packages/EasyArguments) [![NuGet](https://img.shields.io/nuget/v/EasyArguments.svg)](https://www.nuget.org/packages/EasyArguments/) [![Build](https://github.com/Swellshinider/EasyArguments/actions/workflows/dotnet-desktop.yml/badge.svg?branch=main\u0026event=push)](https://github.com/Swellshinider/EasyArguments/actions/workflows/dotnet-desktop.yml)\n\nEasyArguments is a lightweight .NET library that simplifies the process of parsing command-line arguments into strongly-typed objects.\n\n![NugetPackageInstallation](./Documentation/Images/help_sample.png)\n\n\u003c/div\u003e\n\n## Table of Contents\n\n- [EasyArguments](#easyarguments)\n\t- [Table of Contents](#table-of-contents)\n\t- [About the project](#about-the-project)\n\t\t- [Key Features ✨](#key-features-)\n\t\t- [Why EasyArguments? 🚀](#why-easyarguments-)\n\t- [Installation 👌](#installation-)\n\t- [Quick Test](#quick-test)\n\t- [Usage Example 📝](#usage-example-)\n\t\t- [1) Setup an argument class](#1-setup-an-argument-class)\n\t\t- [2) Create an instance of ArgumentsController](#2-create-an-instance-of-argumentscontroller)\n\t- [Contribution ❤️](#contribution-️)\n\t- [License 🪪](#license-)\n\n\n## About the project\n\t\t\nParsing command-line arguments in .NET applications can often be cumbersome and error-prone, requiring repetitive code to handle different argument formats, validations, and help documentation. **EasyArguments** streamlines this process by providing a simple, declarative way to map command-line arguments to strongly-typed objects with minimal boilerplate code.\n\n### Key Features ✨\n\n- **Attribute-Based Configuration:** Define arguments using [Argument] attributes directly on your model properties.\n\n- **Strongly-Typed Parsing:** Automatically convert arguments to their correct data types (e.g., `string`, `bool`, `int`).\n\n- **Boolean Flags and Inversion:** Support for flags like `--verbose` and inverted options like `--no-gui` with the `InvertBoolean` parameter.\n\n- **Automatic Help Generation:** Built-in `--help` command generates a formatted help screen based on your argument definitions.\n\n- **Automatic methods execution** Automatically execute any static method that you want while parsing!\n\n- **Validation:** Mark arguments as required, and let the library handle missing or invalid inputs gracefully.\n\n- **Lightweight:** Minimal dependencies and low overhead, designed for performance and simplicity.\n\n### Why EasyArguments? 🚀\n\n- **Reduce Boilerplate:** Eliminate manual parsing loops and condition checks.\n\n- **Intuitive Syntax:** Declare arguments naturally with C# properties and attributes.\n\n- **Flexible:** Supports both short (-n) and long (--name) argument formats.\n\n- **Error Handling:** Clear exception messages guide users when inputs are missing or invalid.\n\nIdeal for developers who want to build robust CLI tools, **EasyArguments** empowers you to define, parse, and validate arguments in minutes. Check out the [Basic Usage Example](#basic-usage-example) to get started or explore the [Full Documentation](./Documentation/Overview.md) for advanced features!\n\n## Installation 👌\n\nYou can install EasyArguments via terminal:\n\n```bash\ndotnet add package EasyArguments\n```\n\nOr via nuget package manager on Visual Studio:\n\n![NugetPackageInstallation](./Documentation/Images/nuget_packagemanager_visualstudio.png)\n\n## Quick Test\n\nTo quickly test the library, clone this repository and run the [Sample Project](./EasyArguments.Sample/).\n\n```bash\ngit clone https://github.com/Swellshinider/EasyArguments.git\ncd EasyArguments\n./run.ps1\n```\n\n## Usage Example 📝\n\nThis is a basic example. For a comprehensive guide, check out the [Full Documentation](./Documentation/Overview.md) 📚. \n\n### 1) Setup an argument class\n\n```csharp\nusing EasyArguments;\nusing EasyArguments.Attributes;\nusing System;\n\n// The 'Name' parameter specifies the name of the application or command,\n// which will be displayed when the user invokes the --help option.\n[ArgumentsController(Name = \"you_app.exe\")]\npublic class MyArgs\n{\n\t\t[Argument(\"-n\", \"--name\", \"Specifies the user name\", Required = true)]\n\t\tpublic string? Name { get; set; }\n\n\t\t[Argument(\"-v\", \"--verbose\", \"Enable verbose output\", Required = false)]\n\t\tpublic bool? Verbose { get; set; }\n\n\t\t[Argument(null, \"--no-gui\", \"Disable the GUI\", InvertBoolean = true)]\n\t\tpublic bool GuiEnabled { get; set; }\n}\n```\n\n### 2) Create an instance of ArgumentsController\n\n```csharp\nusing EasyArguments;\n\npublic class Program\n{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\t\t// Instantiate a controller for your argument class\n\t\t\t\t\t\tvar controller = new ArgumentsController\u003cMyArgs\u003e(args);\n\n\t\t\t\t\t\t// Parse the given args\n\t\t\t\t\t\tMyArgs parsed = controller.Parse();\n\n\t\t\t\t\t\t// Now you can use properties as you want:\n\t\t\t\t\t\tConsole.WriteLine($\"Name: {parsed.Name}\");\n\t\t\t\t\t\tConsole.WriteLine($\"Verbose: {parsed.Verbose}\");\n\t\t\t\t\t\tConsole.WriteLine($\"GUI enabled: {parsed.GuiEnabled}\");\n\t\t\t\t}\n\t\t\t\tcatch (Exception ex)\n\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(ex.Message);\n\t\t\t\t}\n\t\t}\n}\n```\n\n## Contribution ❤️\n\nContributions are welcome!  \nIf you have ideas to improve **EasyArguments** feel free to open an issue.\n\n## License 🪪\n\nThis project is licensed under the GPLv3 License. See the [LICENSE](./LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswellshinider%2Feasyarguments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswellshinider%2Feasyarguments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswellshinider%2Feasyarguments/lists"}