{"id":21429976,"url":"https://github.com/mblumtritt/parse-argv","last_synced_at":"2025-03-16T21:44:33.091Z","repository":{"id":63816443,"uuid":"556404788","full_name":"mblumtritt/parse-argv","owner":"mblumtritt","description":"A command line parser that only needs your help text.","archived":false,"fork":false,"pushed_at":"2023-12-29T20:19:10.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-15T22:29:43.316Z","etag":null,"topics":["argv","argv-parser","cli","parse","parser","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mblumtritt.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":"2022-10-23T19:24:13.000Z","updated_at":"2022-11-26T18:20:26.000Z","dependencies_parsed_at":"2023-12-29T22:24:13.708Z","dependency_job_id":"83ac8b8c-0052-47ee-b09d-c9e6529cabb9","html_url":"https://github.com/mblumtritt/parse-argv","commit_stats":{"total_commits":81,"total_committers":2,"mean_commits":40.5,"dds":"0.41975308641975306","last_synced_commit":"5aed2703c6eb4ed6687b4af392de4c6dd9618274"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fparse-argv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fparse-argv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fparse-argv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Fparse-argv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mblumtritt","download_url":"https://codeload.github.com/mblumtritt/parse-argv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243940062,"owners_count":20372044,"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":["argv","argv-parser","cli","parse","parser","ruby","ruby-gem"],"created_at":"2024-11-22T22:19:58.862Z","updated_at":"2025-03-16T21:44:33.055Z","avatar_url":"https://github.com/mblumtritt.png","language":"Ruby","readme":"# ParseArgv ![version](https://img.shields.io/gem/v/parse-argv?label=)\n\nA command line parser that only needs your help text.\n\n- Gem: [rubygems.org](https://rubygems.org/gems/parse-argv)\n- Source: [github.com](https://github.com/mblumtritt/parse-argv)\n- Help: [rubydoc.info](https://rubydoc.info/gems/parse-argv/ParseArgv)\n\n## Description\n\nJust write the help text for your application and ParseArgv will take care of your command line. It works sort of the other way around than OptParse, where you write a lot of code to get a command line parser and generated help text. ParseArgv simply takes your help text and parses the command line and presents you the results.\n\nYou can use ParseArgv for simpler programs just as well as for CLI with multi-level sub-commands (git-like commands). ParseArgv is easy to use, fast and also helps you convert the data types of command line arguments.\n\n## Example\n\nThe given help text\n\n```\nusage: test [options] \u003cinfile\u003e [\u003coutfile\u003e]\n\nThis is just a demonstration.\n\noptions:\n  -f, --format \u003cformat\u003e   specify the format\n  --verbose               enable verbose mode\n  -h, --help              print this help text\n```\n\nwill be interpreted as\n\n- there is a command \"test\"\n- which requires and argument \"infile\"\n- optionally accepts an  second argument \"outfile\"\n- accepts an option named \"format\" when `-f` or `--format` are given\n- defines the boolean option \"verbose\" when `--verbose` is given\n- defines the boolean option \"help\" when `-h` or `--help` are given\n\n## How To Use\n\nPlease, see the [Gem's help](https://rubydoc.info/gems/parse-argv/ParseArgv) for detailed information, or have a look at the  [`./examples`](./examples) directory which contains some commands to play around.\n\nThe supported help text syntax and the command line interface syntax are described in the [syntax help](./syntax.md).\n\nIn general you just specify the help text and get the parsed command line:\n\n```ruby\nrequire 'parse-argv'\n\nargs = ParseArgv.from \u003c\u003c~HELP\n  usage: test [options] \u003cinfile\u003e [\u003coutfile\u003e]\n\n  This is just a demonstration.\n\n  options:\n    -f, --format \u003cformat\u003e   specify the format\n    --verbose               enable verbose mode\n    -h, --help              print this help text\nHELP\n\nargs.verbose?\n#=\u003e true, when \"--verbose\" argument was specified\n#=\u003e false, when \"--verbose\" argument was not specified\n\nargs[:infile].as(File, :readable)\n#=\u003e file name\n\nargs.outfile?\n#=\u003e true, when second argument was specified\nargs.outfile\n#=\u003e second argument or nil when not specified\n```\n\n## Installation\n\nUse [Bundler](http://gembundler.com/) to add ParseArgv in your own project:\n\nInclude in your `Gemfile`:\n\n```ruby\ngem 'parse-argv'\n```\n\nand install it by running Bundler:\n\n```bash\nbundle\n```\n\nTo install the gem globally use:\n\n```bash\ngem install parse-argv\n```\n\nAfter that you need only a single line of code in your project to have it on board:\n\n```ruby\nrequire 'parse-argv'\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Fparse-argv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmblumtritt%2Fparse-argv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Fparse-argv/lists"}