{"id":13414893,"url":"https://github.com/bilal-fazlani/commanddotnet","last_synced_at":"2025-05-14T04:10:12.903Z","repository":{"id":38961906,"uuid":"108183590","full_name":"bilal-fazlani/commanddotnet","owner":"bilal-fazlani","description":"A modern framework for building modern CLI apps","archived":false,"fork":false,"pushed_at":"2025-01-26T07:39:24.000Z","size":5367,"stargazers_count":599,"open_issues_count":13,"forks_count":29,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-11T13:41:02.881Z","etag":null,"topics":["argument-parser","command-line","console-application","csharp","dotnet-core"],"latest_commit_sha":null,"homepage":"https://commanddotnet.bilal-fazlani.com","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/bilal-fazlani.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,"zenodo":null}},"created_at":"2017-10-24T21:05:21.000Z","updated_at":"2025-05-04T14:46:08.000Z","dependencies_parsed_at":"2024-01-05T20:51:30.848Z","dependency_job_id":"805e5edb-c3e5-444f-a92e-98172d911363","html_url":"https://github.com/bilal-fazlani/commanddotnet","commit_stats":{"total_commits":1399,"total_committers":11,"mean_commits":"127.18181818181819","dds":0.6583273766976412,"last_synced_commit":"3111f51d7fa36b758994ddc6922f10cbd9c02339"},"previous_names":[],"tags_count":285,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilal-fazlani%2Fcommanddotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilal-fazlani%2Fcommanddotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilal-fazlani%2Fcommanddotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilal-fazlani%2Fcommanddotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bilal-fazlani","download_url":"https://codeload.github.com/bilal-fazlani/commanddotnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253575700,"owners_count":21930163,"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":["argument-parser","command-line","console-application","csharp","dotnet-core"],"created_at":"2024-07-30T21:00:39.412Z","updated_at":"2025-05-14T04:10:07.869Z","avatar_url":"https://github.com/bilal-fazlani.png","language":"C#","funding_links":[],"categories":["CLI","Frameworks, Libraries and Tools","框架, 库和工具","C# #","[Dotnet](https://dotnet.microsoft.com/)"],"sub_categories":["Misc","大杂烩"],"readme":"\u003cimg src=\"./images/logo.png\" width=\"250px\" /\u003e\n\n![Nuget](https://img.shields.io/nuget/v/commanddotnet?style=for-the-badge)\n[![NuGet Pre Release](https://img.shields.io/nuget/vpre/CommandDotNet.svg?style=for-the-badge)](https://www.nuget.org/packages/CommandDotNet)\n[![NuGet](https://img.shields.io/nuget/dt/CommandDotNet.svg?style=for-the-badge)](https://www.nuget.org/packages/CommandDotNet)\n[![GitHub](https://img.shields.io/github/license/bilal-fazlani/commanddotnet?style=for-the-badge)](https://github.com/bilal-fazlani/commanddotnet/blob/master/LICENSE)\n\n[![GitHub last commit](https://img.shields.io/github/last-commit/bilal-fazlani/CommandDotNet.svg?style=for-the-badge)]()\n![Netlify](https://img.shields.io/netlify/ce6331f7-bbfb-4a8a-ba7c-705b2902c4f5?label=Netlify%20Build\u0026style=for-the-badge)\n[![Build](https://img.shields.io/github/workflow/status/bilal-fazlani/commanddotnet/Test/master?style=for-the-badge)](https://github.com/bilal-fazlani/commanddotnet/actions/workflows/test.yml)\n\n[![Gitter](https://img.shields.io/gitter/room/badges/shields.svg?style=for-the-badge)](https://gitter.im/CommandDotNet/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n[![Discord](https://img.shields.io/discord/678568687556493322?label=Discord%20Chat\u0026style=for-the-badge)](https://discord.gg/QFxKSeG)\n\n# CommandDotNet\n\n### A modern framework for building modern CLI apps\n\nOut of the box support for commands, sub-commands, validations, dependency injection, \npiping and streaming, enums \u0026 custom types, typo suggestions, prompting, passwords, response files and much more! \nSee the [features page](https://commanddotnet.bilal-fazlani.com/features). \n\nFavors [POSIX conventions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html)\n\nIncludes [test tools](TestTools/overview.md) used by the framework to test all features of the framework.\n\nModify and extend the functionality of the framework through configuration and middleware.\n\n### Documentation 👉 https://commanddotnet.bilal-fazlani.com\n\n## Project Status\n\nThis project is stable. Lack of new features are a result of the maturity of the library, not an indication of the liveliness of this project. \nWe are available to fix bugs and answer questions and remain fairly responsive. There are PRs and issues in the backlog for new features that are currently low priority for the maintainers.  We will accept PRs.  If you haven't discussed them with us first and the change is significant, please consider the submission the beginning of a design discussion.\n\n## Support\n\nFor bugs, [create an issue](https://github.com/bilal-fazlani/commanddotnet/issues/new)\n\nFor questions and feature requests, start [a discussion](https://github.com/bilal-fazlani/commanddotnet/discussions)\n\nFor a quick walkthrough of features, see our [Getting Started guides](https://commanddotnet.bilal-fazlani.com/gettingstarted/getting-started-0/)\n\nHere's a starter:\n\n### Example\nBegin by creating the commands:\n\n\u003c!-- snippet: getting-started-100-calculator --\u003e\n\u003ca id='snippet-getting-started-100-calculator'\u003e\u003c/a\u003e\n```cs\npublic class Program\n{\n    // this is the entry point of your application\n    static int Main(string[] args)\n    {\n        // AppRunner\u003cT\u003e where T is the class defining your commands\n        // You can use Program or create commands in another class\n        return new AppRunner\u003cProgram\u003e().Run(args);\n    }\n\n    // Add command with two positional arguments\n    public void Add(int x, int y) =\u003e Console.WriteLine(x + y);\n\n    // Subtract command with two positional arguments\n    public void Subtract(int x, int y) =\u003e Console.WriteLine(x - y);\n}\n```\n\u003csup\u003e\u003ca href='https://github.com/bilal-fazlani/commanddotnet/blob/master/CommandDotNet.DocExamples/GettingStarted/Getting_Started_100_Calculator.cs#L11-L28' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-getting-started-100-calculator' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n\nThat's it. You now have an application with two commands. Let's see about how we can call it from command line.\n\nAssuming our application's name is `calculator.dll`, let's run this app from command line using dotnet.\nFirst we'll check out the auto-generated help.\n\n\u003c!-- snippet: getting-started-100-calculator-help --\u003e\n\u003ca id='snippet-getting-started-100-calculator-help'\u003e\u003c/a\u003e\n```bash\n$ dotnet calculator.dll --help\nUsage: dotnet calculator.dll [command]\n\nCommands:\n\n  Add\n  Subtract\n\nUse \"dotnet calculator.dll [command] --help\" for more information about a command.\n```\n\u003csup\u003e\u003ca href='https://github.com/bilal-fazlani/commanddotnet/blob/master/CommandDotNet.DocExamples/BashSnippets/getting-started-100-calculator-help.bash#L1-L11' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-getting-started-100-calculator-help' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n\nFrom the root we can see the available commands. Instead of `--help` we could have used `-h` or `-?`. \nWe'll use `-h` to get help for the _Add_ command.\n\n\u003c!-- snippet: getting-started-100-calculator-add-help --\u003e\n\u003ca id='snippet-getting-started-100-calculator-add-help'\u003e\u003c/a\u003e\n```bash\n$ dotnet calculator.dll Add -h\nUsage: dotnet calculator.dll Add \u003cx\u003e \u003cy\u003e\n\nArguments:\n\n  x  \u003cNUMBER\u003e\n\n  y  \u003cNUMBER\u003e\n```\n\u003csup\u003e\u003ca href='https://github.com/bilal-fazlani/commanddotnet/blob/master/CommandDotNet.DocExamples/BashSnippets/getting-started-100-calculator-add-help.bash#L1-L10' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-getting-started-100-calculator-add-help' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n\nLet's try it out by adding two numbers\n\n\u003c!-- snippet: getting-started-100-calculator-add --\u003e\n\u003ca id='snippet-getting-started-100-calculator-add'\u003e\u003c/a\u003e\n```bash\n$ dotnet calculator.dll Add 40 20\n60\n```\n\u003csup\u003e\u003ca href='https://github.com/bilal-fazlani/commanddotnet/blob/master/CommandDotNet.DocExamples/BashSnippets/getting-started-100-calculator-add.bash#L1-L4' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-getting-started-100-calculator-add' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n\nCommandDotNet will validate if the arguments can be converted to the correct type.\n\n\u003c!-- snippet: getting-started-100-calculator-add-invalid --\u003e\n\u003ca id='snippet-getting-started-100-calculator-add-invalid'\u003e\u003c/a\u003e\n```bash\n$ dotnet calculator.dll Add a 20\n'a' is not a valid Number\n```\n\u003csup\u003e\u003ca href='https://github.com/bilal-fazlani/commanddotnet/blob/master/CommandDotNet.DocExamples/BashSnippets/getting-started-100-calculator-add-invalid.bash#L1-L4' title='Snippet source file'\u003esnippet source\u003c/a\u003e | \u003ca href='#snippet-getting-started-100-calculator-add-invalid' title='Start of snippet'\u003eanchor\u003c/a\u003e\u003c/sup\u003e\n\u003c!-- endSnippet --\u003e\n\nCheck out the docs for more examples\n\nSee our [Getting Started guides](https://commanddotnet.bilal-fazlani.com/gettingstarted/getting-started-0/) to see how to improve the help documentation, test the application and utilize the many other features of CommandDotNet.\n\n## Credits 🎉\n\nSpecial thanks to [Drew Burlingame](https://github.com/drewburlingame) for continuous support and contributions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbilal-fazlani%2Fcommanddotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbilal-fazlani%2Fcommanddotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbilal-fazlani%2Fcommanddotnet/lists"}