{"id":18339487,"url":"https://github.com/antelcat/parameterization","last_synced_at":"2025-04-06T05:32:06.170Z","repository":{"id":209496312,"uuid":"724218578","full_name":"Antelcat/Parameterization","owner":"Antelcat","description":"Effortlessly Build Command-Line Applications with [Parameterization]","archived":false,"fork":false,"pushed_at":"2023-12-23T11:56:07.000Z","size":115,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T23:02:34.434Z","etag":null,"topics":["cli","cli-app","command-line","efficiency","source-generator"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Antelcat.Parameterization","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/Antelcat.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":"2023-11-27T16:27:43.000Z","updated_at":"2024-06-13T10:21:40.718Z","dependencies_parsed_at":"2024-06-13T10:21:37.829Z","dependency_job_id":null,"html_url":"https://github.com/Antelcat/Parameterization","commit_stats":null,"previous_names":["antelcat/antelcat.parameterization"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FParameterization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FParameterization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FParameterization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FParameterization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Antelcat","download_url":"https://codeload.github.com/Antelcat/Parameterization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247440398,"owners_count":20939220,"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":["cli","cli-app","command-line","efficiency","source-generator"],"created_at":"2024-11-05T20:18:00.713Z","updated_at":"2025-04-06T05:32:04.200Z","avatar_url":"https://github.com/Antelcat.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Antelcat.Parameterization: Effortless Command-Line Application Builder\n\n### English | [中文](readme_cn.md)\n\nWelcome to Antelcat.Parameterization, a powerful source generator designed to revolutionize the way you create command-line applications. This tool simplifies the process of building CLI applications by automatically generating parsing methods with just attribute marking on classes and methods.\n\n## Features\n\n- **Attribute-Driven Development**: Easily define commands and arguments using attributes.\n- **Automatic Parsing**: Automatically generates methods for parsing command-line arguments.\n- **Custom Type Converter**: Works well with `System.ComponentModel.StringConverter`.\n\n## Demo\n\nThe [Demo Program](https://github.com/Antelcat/Antelcat.Parameterization/blob/master/src/Antelcat.Parameterization.Demo/Program.cs) implements a simple [Docker](https://www.docker.com/) application to show its features.\n\n1. **Pull an Image**:\n\n   Command:\n\n   ```bash\n   \u003e pull ubuntu\n   ```\n\n   Output:\n\n   ```bash\n   Pulling image ubuntu:latest...\n   Successfully Pulled image ubuntu:latest\n   ```\n\n   In this example, a custom `Image` class is seamlessly converted from a `string`, thanks to the `[TypeConverter(typeof(ImageConverter))]` attribute applied to `Image`. Additionally, for locally use, the `[Argument(Converter = typeof(ImageConverter))] Image image` annotation allows the same seamless conversion.\n\n2. **Run a Container**:\n\n   Command:\n\n   ```bash\n   \u003e run ubuntu\n   ```\n\n   Output:\n\n   ```bash\n   ubuntu:latest ubuntu running\n   ```\n\n   This demonstrates how the default value for the `name` parameter is automatically used when it's not provided in the input.\n\n3. **Display Container Statistics**:\n\n   Command:\n\n   ```bash\n   \u003e ps\n   ```\n\n   Output:\n\n   ```bash\n   CONTAINER_ID    IMAGE           NAME    STATUS\n   00a57dbe        ubuntu:latest   ubuntu  running\n   ```\n\n4. **Stop a Container and Run a New One**:\n\n   Commands:\n\n   ```bash\n   \u003e stop\n   \u003e stop 00a57dbe\n   \u003e run --name \"my container\" --image kali\n   ```\n\n   Output:\n\n   ```bash\n   Argument \"id\" is not specified.\n   Stopping container 00a57dbe...\n   Pulling image kali:latest...\n   Successfully Pulled image kali:latest\n   kali:latest my container running\n   ```\n\n   This example highlights the use of named switches, allowing argument reordering. Additionally, it showcases how strings enclosed in `\"\"` are correctly parsed.\n\n5. **Display Updated Container Statistics**:\n\n   Command:\n\n   ```bash\n   \u003e ps --all\n   ```\n\n   Output:\n\n   ```bash\n   CONTAINER_ID    IMAGE           NAME          STATUS\n   00a57dbe        ubuntu:latest   ubuntu        stopped\n   0419fcea        kali:latest     my container  running\n   ```\n\n   First, `Argument(FullName = \"all\")` replaces the full name of the original `showAll`. `Argument(ShortName = \"a\")` means `ps -a` also works as same.\n\n   Second, the effect of `ArgumentAttribute.DefaultValue` is evident. When a switch is used without an accompanying value, the `ArgumentAttribute.DefaultValue` is automatically converted and used to fill the argument, regardless of the default parameter value of `bool showAll = false`.\n\n## Installation\n\n- **Via Nuget (✨Recommanded)**\n\n  Uploaded to [Nuget](https://www.nuget.org/packages/Antelcat.Parameterization). You can install via nuget CLI or your favorite IDE.\n\n- **Via source code**\n\n  1. Clone or download zip of the source code.\n  2. Reference `Antelcat.Parameterization` and `Antelcat.Parameterization.SourceGenerators` as follows.\n  \n     ```xml\n     \u003cItemGroup\u003e\n         \u003cProjectReference Include=\"..\\Antelcat.Parameterization\\Antelcat.Parameterization.csproj\"/\u003e\n         \u003cProjectReference Include=\"..\\Antelcat.Parameterization.SourceGenerators\\Antelcat.Parameterization.SourceGenerators.csproj\" OutputItemType=\"Analyzer\" ReferenceOutputAssembly=\"false\"/\u003e\n     \u003c/ItemGroup\u003e\n     ```\n  \n     **NOTICE** that `OutputItemType=\"Analyzer\" ReferenceOutputAssembly=\"false\"` is necessary because it is a Source Generator.\n  \n  3. Enjoy.\n\n## Contributing\n\nWe welcome contributions to this project! Whether it's reporting bugs, suggesting enhancements, or adding new features, your input is valuable to us.\n\n## TODO\n\n- [x] Nuget package.\n- [x] Multiple parameters, use `T[]`.\n- [ ] Automatically generate help documents.\n- [ ] Check for excess parameters.\n- [ ] Parameter combination, e.g. `-it` will both open `-i` and `-t`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantelcat%2Fparameterization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantelcat%2Fparameterization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantelcat%2Fparameterization/lists"}