{"id":13546592,"url":"https://github.com/Gabriella439/optparse-generic","last_synced_at":"2025-04-02T18:31:07.883Z","repository":{"id":4281554,"uuid":"52614008","full_name":"Gabriella439/optparse-generic","owner":"Gabriella439","description":"Auto-generate a command-line parser for your datatype","archived":false,"fork":false,"pushed_at":"2024-02-01T23:55:53.000Z","size":164,"stargazers_count":208,"open_issues_count":10,"forks_count":32,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-27T22:45:35.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","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/Gabriella439.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2016-02-26T15:37:18.000Z","updated_at":"2024-08-20T06:30:09.000Z","dependencies_parsed_at":"2023-11-20T01:32:00.737Z","dependency_job_id":"4b22608c-1861-49f8-b793-e5fcc699d357","html_url":"https://github.com/Gabriella439/optparse-generic","commit_stats":{"total_commits":142,"total_committers":27,"mean_commits":"5.2592592592592595","dds":0.4295774647887324,"last_synced_commit":"449bc408169606d450a82f198821cfbe846b2f46"},"previous_names":["gabriel439/haskell-optparse-generic-library"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gabriella439%2Foptparse-generic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gabriella439%2Foptparse-generic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gabriella439%2Foptparse-generic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gabriella439%2Foptparse-generic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gabriella439","download_url":"https://codeload.github.com/Gabriella439/optparse-generic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222856264,"owners_count":17048289,"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-08-01T12:00:40.686Z","updated_at":"2024-11-03T14:31:50.472Z","avatar_url":"https://github.com/Gabriella439.png","language":"Haskell","funding_links":[],"categories":["Haskell"],"sub_categories":[],"readme":"# optparse-generic\n\nUse this library to auto-generate a command-line interface that parses a typed\nvalue.  This library uses Haskell's support for generic programming to\ncustomize the command-line interface to the type of value that you request.\n\nFor example, the following program:\n\n```haskell\n{-# LANGUAGE DeriveGeneric     #-}\n{-# LANGUAGE OverloadedStrings #-}\n\nimport Options.Generic\n\ndata Example = Example { foo :: Int, bar :: Double } deriving (Generic, Show)\n\ninstance ParseRecord Example\n\nmain = do\n    x \u003c- getRecord \"Test program\"\n    print (x :: Example)\n```\n\n... will generate a command-line interface that has one flag per field of the\nrecord:\n\n```bash\n$ stack build optparse-generic\n$ stack runghc Example.hs -- --help\nTest program\n\nUsage: Example.hs --foo INT --bar DOUBLE\n\nAvailable options:\n  -h,--help                Show this help text\n\n$ stack runghc Example.hs -- --foo 1 --bar 2.5\nExample {foo = 1, bar = 2.5}\n```\n\nThis library also provides support out-of-the-box for many existing Haskell\ntypes.  Try to run this program to see what command-line interface it generates:\n\n```haskell\n{-# LANGUAGE DeriveGeneric     #-}\n{-# LANGUAGE OverloadedStrings #-}\n\nimport Options.Generic\n\nmain = do\n    x \u003c- getRecord \"Test program\"\n    print (x :: Either Double Int)\n```\n\nThis library tries to be as intelligent as possible:\n\n* Unlabeled fields become positional arguments\n* Data types with multiple constructors auto-generate subcommands\n* The `Maybe` type constructor translates to an optional flag/argument\n* The `[]` type constructor translates to a repeated flag/argument\n* `Any`/`All`/`First`/`Last`/`Sum`/`Product` also translate to repeated\n  arguments, but with different behaviors (i.e. `First` will return the first\n  option/argument that matches and `Sum` will sum them all)\n\nFor the full tutorial, read the\n[Hackage documentation](http://hackage.haskell.org/package/optparse-generic/docs/Options-Generic.html)\n\n## Development status\n\n[![Build Status](https://travis-ci.org/Gabriella439/Haskell-Optparse-Generic-Library.png)](https://travis-ci.org/Gabriella439/Haskell-Optparse-Generic-Library)\n\nI expect this library's API to be reasonably stable, but only time will tell.\nMost changes will likely be related to adding new built-in support for\nexisting commonly used data types in the Haskell ecosystem by adding new\n`ParseField`, `ParseFields`, or `ParseRecords` instances, but this will not\nrequire any breaking changes to the API.\n\n## LICENSE (BSD 3-Clause)\n\nCopyright (c) 2016 Gabriella Gonzalez  \nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n* Redistributions of source code must retain the above copyright notice,\n  this list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n* Neither the name of Gabriella Gonzalez nor the names of other contributors\n  may be used to endorse or promote products derived from this software\n  without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGabriella439%2Foptparse-generic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGabriella439%2Foptparse-generic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGabriella439%2Foptparse-generic/lists"}