{"id":23273122,"url":"https://github.com/zhaytam/argsparser","last_synced_at":"2026-05-18T00:07:46.221Z","repository":{"id":114359309,"uuid":"121441316","full_name":"zHaytam/ArgsParser","owner":"zHaytam","description":"A command line arguments parser in .NET Core","archived":false,"fork":false,"pushed_at":"2018-02-14T19:16:13.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-01T12:18:21.117Z","etag":null,"topics":["argument-parser","command-line","dotnet-core"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zHaytam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-02-13T21:56:57.000Z","updated_at":"2018-02-14T19:17:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b56c60b-650f-4ce5-8d90-85704851db48","html_url":"https://github.com/zHaytam/ArgsParser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zHaytam/ArgsParser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FArgsParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FArgsParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FArgsParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FArgsParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zHaytam","download_url":"https://codeload.github.com/zHaytam/ArgsParser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zHaytam%2FArgsParser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33160168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"ssl_error","status_checked_at":"2026-05-17T22:39:10.741Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["argument-parser","command-line","dotnet-core"],"created_at":"2024-12-19T19:32:39.618Z","updated_at":"2026-05-18T00:07:46.203Z","avatar_url":"https://github.com/zHaytam.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ArgsParser\n\nA command line arguments parser in .NET Core.\n\n## How to use\n\n### Register the arguments you want\n\n    var argsParser = new ArgumentsParser();\n    argsParser.AddArgument(new Argument(\"-r\", typeof(int), \"--req\", \"A required argument.\"));\n    argsParser.AddArgument(new Argument(\"-o\", typeof(string), \"--opt\", \"An optional argument that doesn't have a value.\", false, true));\n\nThis will tell the ArgumentsParser that `-r, --req` is a required argument that has a value of type int (e.g. `-r 3`) and that `-o, --opt` is an optional argument that doesn't have a value (e.g. `-o`).\n\n### Parse the arguments\n\nAll you have to do is call the `Parse` method with the `string[] args` given to you on the main method.\n\n    try\n    {\n\t    var argsParsed = argsParser.Parse(args);\n\t}\n\tcatch (Exception ex)\n\t{\n\t\t// You'll probably want to exit if the parsing fails\n\t\tConsole.WriteLine(ex.Message);\n        Environment.Exit(1);\n\t}\n\nThe parsing will fail if:\n\n - A required argument is missing.\n - An argument with `HasValue = true` but no value was provided.\n - An error occured when trying to convert the value to the specified type.\n\n### Using the arguments\n\nTo use the arguments you have 2 main methods:\n\n    // GetArgumentValue needs the argument's name\n    int t = argsParsed.GetArgumentValue\u003cint\u003e(\"-t\");\n    \n    // If you have an argument with HasValue = false\n    if (argsParsed.HasArgument(\"-o\"))\n\t    Console.WriteLine(\"-o, --o was specified!\");\n\n### Help\n\nArgsParser automatically provides a help argument:\n\n    dotnet run -- yourapp -h\n    dotnet run -- yourapp --help\n    \n    Available arguments:\n\t\t-h, --help               Shows the available arguments.\n\t\t-r, --req                A required argument.\n\t\t-o, --opt (optional)     An optional argument that doesn't have a value.\n\n**This will print a nicely formated message containing the available arguments and will not parse anything else and return `null`.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaytam%2Fargsparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhaytam%2Fargsparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaytam%2Fargsparser/lists"}