{"id":30062321,"url":"https://github.com/visual-vincent/commandlineparser.extensions","last_synced_at":"2025-08-08T03:10:15.785Z","repository":{"id":306807830,"uuid":"1027267596","full_name":"Visual-Vincent/CommandLineParser.Extensions","owner":"Visual-Vincent","description":"Unofficial, handy extensions for the excellent CommandLineParser library.","archived":false,"fork":false,"pushed_at":"2025-07-27T18:19:03.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-27T19:31:18.748Z","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/Visual-Vincent.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":"2025-07-27T17:04:36.000Z","updated_at":"2025-07-27T18:19:07.000Z","dependencies_parsed_at":"2025-07-27T19:46:31.149Z","dependency_job_id":null,"html_url":"https://github.com/Visual-Vincent/CommandLineParser.Extensions","commit_stats":null,"previous_names":["visual-vincent/commandlineparser.extensions"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Visual-Vincent/CommandLineParser.Extensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual-Vincent%2FCommandLineParser.Extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual-Vincent%2FCommandLineParser.Extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual-Vincent%2FCommandLineParser.Extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual-Vincent%2FCommandLineParser.Extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Visual-Vincent","download_url":"https://codeload.github.com/Visual-Vincent/CommandLineParser.Extensions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual-Vincent%2FCommandLineParser.Extensions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269356907,"owners_count":24403564,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-08-08T03:10:11.416Z","updated_at":"2025-08-08T03:10:15.780Z","avatar_url":"https://github.com/Visual-Vincent.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CommandLineParser.Extensions\n\n[![NuGet](https://img.shields.io/nuget/v/VisualVincent.Extensions.CommandLineParser?style=plastic)](https://www.nuget.org/packages/VisualVincent.Extensions.CommandLineParser/) [![License](https://img.shields.io/github/license/Visual-Vincent/CommandLineParser.Extensions?style=plastic)](/LICENSE)\n\nUnofficial, handy extensions for the excellent CommandLineParser library.\n\n## Features\n\n- Dedicated base class for defining application commands\n- Support for nested commands\n\n## Examples\n\n### A simple command\n\n```sh\nmyapp hello -n John\n```\n\n```csharp\nusing System;\nusing CommandLine;\nusing CommandLine.Extensions;\n\nnamespace MyApp;\n\ninternal class Program\n{\n    public static void Main(string[] args)\n    {\n        Command.ParseAndExecute(args);\n    }\n}\n\n[Verb(\"hello\", HelpText = \"Gives you a personal hello\")]\npublic class SayHello : Command\n{\n    [Option('n', \"name\", HelpText = \"The name to say hello to\", Required = true)]\n    public string Name { get; set; }\n\n    public override void Execute()\n    {\n        Console.WriteLine($\"Hello {Name}!\");\n    }\n}\n```\n\n### Nested commands\n\n```sh\nmyapp remote add 127.0.0.1\nmyapp remote remove 127.0.0.1\n```\n\n```csharp\nusing System;\nusing CommandLine;\nusing CommandLine.Extensions;\n\nnamespace MyApp;\n\ninternal class Program\n{\n    public static void Main(string[] args)\n    {\n        Command.ParseAndExecute(args);\n    }\n}\n\n[Verb(\"remote\", HelpText = \"Handles remote servers\")]\npublic class Remote : Command\n{\n    [Verb(\"add\", HelpText = \"Adds a remote server\")]\n    public class Add : Command\n    {\n        [Value(0, HelpText = \"The URL to the server\", Required = true)]\n        public string Url { get; set; }\n\n        public override void Execute()\n        {\n            // TODO: Add server\n            Console.WriteLine($\"Server {Url} added successfully\");\n        }\n    }\n\n    [Verb(\"remove\", HelpText = \"Removes a remote server\")]\n    public class Remove : Command\n    {\n        [Value(0, HelpText = \"The URL to the server\", Required = true)]\n        public string Url { get; set; }\n\n        public override void Execute()\n        {\n            // TODO: Remove server\n            Console.WriteLine($\"Server {Url} removed successfully\");\n        }\n    }\n\n    public override void Execute()\n    {\n        // In this case solely executing the base \"remote\" command shouldn't do anything.\n        // We can use the Command.HelpText property to print the help text of this command to the console,\n        // indicating to the user that they're missing a subverb.\n        Console.WriteLine(HelpText);\n    }\n}\n```\n\n### Making the verbs case-insensitive\n\n```sh\nmyapp hELLo -n John\n```\n\n```csharp\nusing System;\nusing CommandLine;\nusing CommandLine.Extensions;\n\nnamespace MyApp;\n\ninternal class Program\n{\n    public static void Main(string[] args)\n    {\n        var parser = new Parser(s =\u003e {\n            s.HelpWriter = Console.Error;\n            s.CaseSensitive = false;\n        });\n\n        Command.ParseAndExecute(parser, args);\n    }\n}\n\n[Verb(\"hello\", HelpText = \"Gives you a personal hello\")]\npublic class SayHello : Command\n{\n    [Option('n', \"name\", HelpText = \"The name to say hello to\", Required = true)]\n    public string Name { get; set; }\n\n    public override void Execute()\n    {\n        Console.WriteLine($\"Hello {Name}!\");\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisual-vincent%2Fcommandlineparser.extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisual-vincent%2Fcommandlineparser.extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisual-vincent%2Fcommandlineparser.extensions/lists"}