{"id":15406990,"url":"https://github.com/dannyben/clipper","last_synced_at":"2025-03-01T13:31:33.723Z","repository":{"id":68196726,"uuid":"221665759","full_name":"DannyBen/clipper","owner":"DannyBen","description":"Pure Command Line Arguments Parser","archived":false,"fork":false,"pushed_at":"2019-11-14T12:09:43.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T15:59:54.547Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dannyben.github.io/clipper/","language":"Crystal","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/DannyBen.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":"2019-11-14T10:02:04.000Z","updated_at":"2023-05-12T18:02:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"5acbcd64-97df-428d-b7db-e65bee4d8bbe","html_url":"https://github.com/DannyBen/clipper","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"4603d0d34aa0d67f5993cac8b8cb22bdba795066"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fclipper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fclipper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fclipper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fclipper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DannyBen","download_url":"https://codeload.github.com/DannyBen/clipper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241371376,"owners_count":19952086,"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":"2024-10-01T16:26:37.322Z","updated_at":"2025-03-01T13:31:33.717Z","avatar_url":"https://github.com/DannyBen.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clipper - Pure Command Line Arguments Parser\n\n[![Build Status](https://travis-ci.com/DannyBen/clipper.svg?branch=master)](https://travis-ci.com/DannyBen/clipper)\n\nClipper is a small wrapper around the standard `OptionParser` with these \nconceptual changes:\n\n1. It supports positional arguments (commands or positional parameters).\n2. It simply returns a hash of all the expected flags and positional \n   arguments.\n3. It is designed to let you separate the command line parsing from your\n   actual implementation.\n4. It does not concern itself with any help or usage strings - you need to \n   bring your own.\n5. It stays out of your way.\n\nClipper does not assume anything about how you wish to build your command\nline utility, or how you wish to display its usage.\n\n\n## Installation\n\n\nAdd the dependency to your `shard.yml`:\n\n```yaml\ndependencies:\n  clipper:\n    github: dannyben/clipper\n```\n\nThen run `shards install`\n\n\n## Usage\n\nClipper contains three methods only:\n\n- `#flag` - specify which flags are expected.\n- `#arg` - specify which positional arguments are expected.\n- `#parse` - convert the `ARGV` array to a Hash of all expected and actual\n   options.\n\n```crystal\nrequire \"clipper\"\n\n# Create a clipper instance:\nclipper = Clipper.new\n\n# Specify which flags are expected, using one of these general patterns:\nclipper.flag \"--cache\", \"-c\"\nclipper.flag \"--long-only\"\nclipper.flag \"--port PORT\", \"-p PORT\", default: \"3000\"\n\n# If you care about any positional arguments, give them a name by using this\n# pattern:\nclipper.arg \"command\"\n\n# Finally, parse the options:\noptions = clipper.parse\n# =\u003e {\"--cache\" =\u003e false, \"--long-only\" =\u003e false, \n# =\u003e  \"--port\" =\u003e \"3000\", \"command\" =\u003e false}\n\noptions = clipper.parse [\"--cache\", \"-p\", \"4567\"]\n# =\u003e {\"--cache\" =\u003e true, \"--long-only\" =\u003e false,\n# =\u003e  \"--port\" =\u003e \"4567\", \"command\" =\u003e false}\n\noptions = clipper.parse [\"download\"]\n# =\u003e {\"--cache\" =\u003e true, \"--long-only\" =\u003e false,\n# =\u003e  \"--port\" =\u003e \"4567\", \"command\" =\u003e \"download\"}\n```\n\nFor more advanced examples, see the\n[examples folder](https://github.com/DannyBen/clipper/tree/master/examples).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyben%2Fclipper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdannyben%2Fclipper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyben%2Fclipper/lists"}