{"id":25549657,"url":"https://github.com/netlah/commandlineutils","last_synced_at":"2026-02-14T14:30:19.577Z","repository":{"id":90316044,"uuid":"547179912","full_name":"NetLah/CommandLineUtils","owner":"NetLah","description":"Command line parsing for .NET","archived":false,"fork":false,"pushed_at":"2024-01-10T02:29:08.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-13T03:14:50.695Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/NetLah.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}},"created_at":"2022-10-07T09:03:28.000Z","updated_at":"2022-10-08T13:50:58.000Z","dependencies_parsed_at":"2023-04-12T11:20:42.893Z","dependency_job_id":null,"html_url":"https://github.com/NetLah/CommandLineUtils","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetLah%2FCommandLineUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetLah%2FCommandLineUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetLah%2FCommandLineUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetLah%2FCommandLineUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetLah","download_url":"https://codeload.github.com/NetLah/CommandLineUtils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239816509,"owners_count":19701753,"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":"2025-02-20T10:19:16.300Z","updated_at":"2026-02-14T14:30:19.535Z","avatar_url":"https://github.com/NetLah.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetLah.Extensions.CommandLineUtils - .NET Library\n\n[NetLah.Extensions.CommandLineUtils](https://www.nuget.org/packages/NetLah.Extensions.CommandLineUtils/) Command line parsing for .NET.\n\n## Nuget package\n\n[![NuGet](https://img.shields.io/nuget/v/NetLah.Extensions.CommandLineUtils.svg?style=flat-square\u0026label=nuget\u0026colorB=00b200)](https://www.nuget.org/packages/NetLah.Extensions.CommandLineUtils/)\n\n## Build Status\n\n[![.NET](https://github.com/NetLah/CommandLineUtils/actions/workflows/dotnet.yml/badge.svg)](https://github.com/NetLah/CommandLineUtils/actions/workflows/dotnet.yml)\n\n## Getting started\n\n### 1. Add/Update PackageReference to web .csproj\n\n```xml\n\u003cItemGroup\u003e\n  \u003cPackageReference Include=\"NetLah.Extensions.CommandLineUtils\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\n### 2. Sample Command Line Application\n\n```cs\nCommandLineApplication commandLineApplication =\n    new(throwOnUnexpectedArg: true)\n    {\n        Name = \"SampleCommandLine.exe\",\n        FullName = \"SampleCommandLine: greeting a fullname\"\n    };\n\nCommandArgument? names = null;\n\ncommandLineApplication.Command(\"hello\",\n    (target) =\u003e\n    {\n        target.FullName = \"Greeting a fullname\";\n        target.Description = \"The hello command\";\n        target.ShortVersionGetter = GetShortVersion;\n        target.LongVersionGetter = GetLongVersion;\n\n        names = target.Argument(\n            \"fullname\",\n            \"Enter the full name of the person to be greeted.\",\n            multipleValues: true);\n\n        target.HelpOption(\"-? | -h | --help\");\n\n        target.OnExecute(() =\u003e\n        {\n            if (names?.Values.Any() == true)\n            {\n                Greet(names.Values);\n            }\n            else\n            {\n                // show help if the required argument is missing\n                commandLineApplication.ShowHelp();\n            }\n            return 0;\n        });\n    });\n\ncommandLineApplication.HelpOption(\"-? | -h | --help\");\ncommandLineApplication.VersionOption(\"--version\", GetShortVersion, GetLongVersion);\n\ncommandLineApplication.OnExecute(() =\u003e\n{\n    // show help if root command\n    commandLineApplication.ShowHelp();\n    return 0;\n});\n\ncommandLineApplication.Execute(args);\n\nstatic void Greet(IEnumerable\u003cstring\u003e values) =\u003e Console.WriteLine($\"Hello {string.Join(\" \", values)}!\");\n\nstatic string GetShortVersion() =\u003e \"1.2.3\";\n\nstatic string GetLongVersion() =\u003e \"v1.2.3+456abcd\";\n```\n\n## Play around\n\n### 1. Get help on root\n\nTo know the available commands and options `SampleCommandLine.exe --help`\n\n```txt\nSampleCommandLine: greeting a fullname 1.2.3\n\nUsage: SampleCommandLine.exe [options] [command]\n\nOptions:\n  -? | -h | --help  Show help information\n  --version         Show version information\n\nCommands:\n  hello  The hello command\n\nUse \"SampleCommandLine.exe [command] --help\" for more information about a command.\n```\n\n### 2. Get help on hello command\n\nTo know the available arguments and options of a command `SampleCommandLine.exe hello --help`\n\n```txt\nGreeting a fullname 1.2.3\n\nUsage: SampleCommandLine.exe hello [arguments] [options]\n\nArguments:\n  fullname  Enter the full name of the person to be greeted.\n\nOptions:\n  -? | -h | --help  Show help information\n```\n\n### 3. Greeting a fullname\n\nCommand line `SampleCommandLine.exe hello John Doe`\n\n```txt\nHello John Doe!\n```\n\n### 4. Check version\n\nCommand line `SampleCommandLine.exe --version`\n\n```txt\nSampleCommandLine: greeting a fullname\nv1.2.3+456abcd\n```\n\n## Project origin and status\n\nThis repos a fork of [Microsoft.Extensions.CommandLineUtils](https://github.com/dotnet/extensions). [Microsoft announces](https://github.com/dotnet/extensions/issues/257) discontinue support the library. You may check this [repos](https://github.com/natemcmaster/CommandLineUtils) if prefer the more enrich features.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetlah%2Fcommandlineutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetlah%2Fcommandlineutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetlah%2Fcommandlineutils/lists"}