{"id":15403189,"url":"https://github.com/woodruffw/dreck","last_synced_at":"2025-10-26T21:44:40.449Z","repository":{"id":56423872,"uuid":"95077333","full_name":"woodruffw/dreck","owner":"woodruffw","description":"A stupid parser for trailing arguments.","archived":false,"fork":false,"pushed_at":"2020-11-09T00:46:35.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T09:05:42.455Z","etag":null,"topics":["argument-parser","option-parser","ruby","type-checking"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/dreck","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/woodruffw.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}},"created_at":"2017-06-22T05:17:48.000Z","updated_at":"2020-11-09T00:46:35.000Z","dependencies_parsed_at":"2022-08-15T18:30:32.214Z","dependency_job_id":null,"html_url":"https://github.com/woodruffw/dreck","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/woodruffw/dreck","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fdreck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fdreck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fdreck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fdreck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woodruffw","download_url":"https://codeload.github.com/woodruffw/dreck/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodruffw%2Fdreck/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281178948,"owners_count":26456678,"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-10-26T02:00:06.575Z","response_time":61,"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":["argument-parser","option-parser","ruby","type-checking"],"created_at":"2024-10-01T16:06:41.680Z","updated_at":"2025-10-26T21:44:40.428Z","avatar_url":"https://github.com/woodruffw.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"dreck\n=====\n\n![license](https://raster.shields.io/badge/license-MIT%20with%20restrictions-green.png)\n[![Build Status](https://img.shields.io/github/workflow/status/woodruffw/dreck/CI/master)](https://github.com/woodruffw/dreck/actions?query=workflow%3ACI)\n[![Gem Version](https://badge.fury.io/rb/dreck.svg)](https://badge.fury.io/rb/dreck)\n\nA stupid parser for trailing arguments.\n\n### Motivation\n\nThere are lots of good argument parsers for Ruby:\n[OptionParser](https://ruby-doc.org/stdlib/libdoc/optparse/rdoc/OptionParser.html),\n[Slop](https://github.com/leejarvis/slop), [trollop](https://manageiq.github.io/trollop/),\n[cocaine](https://github.com/thoughtbot/cocaine), etc.\n\nMost of these are great for parsing and typechecking options, but none provide a good\ninterface to the arguments that often *trail* the options.\n\nDreck does exactly that. Give it a specification of arguments (and their\ntypes) to expect, and it will give you a nicely typechecked result.\n\n### Installation\n\n```bash\n$ gem install dreck\n```\n\n### Usage\n\nDreck is best used in conjunction with an option parser like\n[Slop](https://github.com/leejarvis/slop), which can provide an array of\narguments with options already filtered out:\n\n```ruby\nopts = Slop.parse do |s|\n  # ...\nend\n\nopts.args # =\u003e [ \"/dev/urandom\", \"/dev/sda\", \"512\" ]\n\nresults = Dreck.parse opts.args, strict: true do\n  file   :input\n  symbol :output\n  int    :blocksize\nend\n\nresults[:input] # =\u003e \"/dev/urandom\"\nresults[:output] # =\u003e :\"/dev/sda\"\nresults[:blocksize] # =\u003e 512\n```\n\nLists are also supported:\n\n```ruby\nresult = Dreck.parse opts.args do\n  string :uuid\n  list   :file, :inputs, count: 2\n  list   :int, :nums\nend\n\nresult[:uuid] # =\u003e \"01aa84ab-5b2c-4861-adc9-fcc6990a5ca5\"\nresult[:inputs] # =\u003e [\"/tmp/foo\", \"/tmp/bar\"]\nresult[:nums] # =\u003e [1, 2, 3, 4, 5]\n```\n\n### TODO\n\n* Guarding against multiple unbound lists/unbound list before scalar types\n* Custom types?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoodruffw%2Fdreck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoodruffw%2Fdreck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoodruffw%2Fdreck/lists"}