{"id":15713686,"url":"https://github.com/erdnaxeli/clip","last_synced_at":"2025-07-11T04:34:50.965Z","repository":{"id":150614944,"uuid":"349811327","full_name":"erdnaxeli/clip","owner":"erdnaxeli","description":"Deserialize CLI parameters to an object, with errors and help management.","archived":false,"fork":false,"pushed_at":"2021-04-11T20:32:30.000Z","size":481,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-19T07:22:54.911Z","etag":null,"topics":["cli","crystal","crystal-lang"],"latest_commit_sha":null,"homepage":"https://erdnaxeli.github.io/clip/","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/erdnaxeli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","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":"2021-03-20T18:57:45.000Z","updated_at":"2022-10-12T23:26:10.000Z","dependencies_parsed_at":"2023-05-26T13:15:17.896Z","dependency_job_id":null,"html_url":"https://github.com/erdnaxeli/clip","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdnaxeli%2Fclip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdnaxeli%2Fclip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdnaxeli%2Fclip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdnaxeli%2Fclip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erdnaxeli","download_url":"https://codeload.github.com/erdnaxeli/clip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249942422,"owners_count":21349019,"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":["cli","crystal","crystal-lang"],"created_at":"2024-10-03T21:32:54.132Z","updated_at":"2025-04-20T18:32:56.920Z","avatar_url":"https://github.com/erdnaxeli.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clip\n\nClip (CLI Parser) allows you to deserialize CLI parameters into an object, and\ngenerates the help for you.\n\nThe goal of Clip is to let you in control.\nIt does not execute your code.\nIt does not print anything.\nIt can read from ARGV but also from any array of strings.\nYou choose what you want to do.\n\n**Documentation**: \u003chttps://erdnaxeli.github.io/clip/\u003e\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     clip:\n       github: erdnaxeli/clip\n   ```\n\n2. Run `shards install`\n\n## Usage\n\nIn a file command.cr:\n```crystal\nrequire \"clip\"\n\n@[Clip::Doc(\"An example commmand.\")]\nstruct Command\n  include Clip::Mapper\n\n  @[Clip::Doc(\"Enable some effect.\")]\n  getter effect = false\n\n  @[Clip::Doc(\"The file to work on.\")]\n  getter file : String\nend\n\nbegin\n  command = Command.parse\nrescue ex : Clip::ParsingError\n  puts ex\n  exit\nend\n\ncase command\nwhen Clip::Mapper::Help\n  puts command.help\nelse\n  if command.effect\n    puts \"Doing something with an effect on #{command.file}.\"\n  else\n    puts \"Doing something on #{command.file}.\"\n  end\nend\n```\n\nThen:\n```Shell\n$ crystal build command.cr\n$ ./command\nError:\n  argument is required: FILE\n$ ./command --help\nUsage: ./command [OPTIONS] FILE\n\nAn example commmand.\n\nArguments:\n  FILE  The file to work on.  [required]\n\nOptions:\n  --effect / --no-effect  Enable some effect.  [default: false]\n  --help                  Show this message and exit.\n$ ./command myfile\nDoing something on myfile.\n$ ./command --effect myfile\nDoing something with an effect on myfile.\n```\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/erdnaxeli/clip/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Alexandre Morignot](https://github.com/erdnaxeli) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdnaxeli%2Fclip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferdnaxeli%2Fclip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdnaxeli%2Fclip/lists"}