{"action":"closed","number":511,"pull_request":{"url":"https://api.github.com/repos/CakeML/cakeml/pulls/511","id":208597621,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4NTk3NjIx","html_url":"https://github.com/CakeML/cakeml/pull/511","diff_url":"https://github.com/CakeML/cakeml/pull/511.diff","patch_url":"https://github.com/CakeML/cakeml/pull/511.patch","issue_url":"https://api.github.com/repos/CakeML/cakeml/issues/511","number":511,"state":"closed","locked":false,"title":"ArgParse for CakeML","user":{"login":"agomezl","id":1539099,"node_id":"MDQ6VXNlcjE1MzkwOTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1539099?v=4","gravatar_id":"","url":"https://api.github.com/users/agomezl","html_url":"https://github.com/agomezl","followers_url":"https://api.github.com/users/agomezl/followers","following_url":"https://api.github.com/users/agomezl/following{/other_user}","gists_url":"https://api.github.com/users/agomezl/gists{/gist_id}","starred_url":"https://api.github.com/users/agomezl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agomezl/subscriptions","organizations_url":"https://api.github.com/users/agomezl/orgs","repos_url":"https://api.github.com/users/agomezl/repos","events_url":"https://api.github.com/users/agomezl/events{/privacy}","received_events_url":"https://api.github.com/users/agomezl/received_events","type":"User","site_admin":false},"body":"This is a relatively simple library for parsing arguments using a declarative interface for specifying which kind of argument/options to take. the following example shows a simple use case.\r\n\r\nAssume a program `foo` with the following arguments\r\n```\r\nUsage foo\r\n  -f  --input     Input file to use\r\n  -o  --output    Output file\r\n  -h  --help      This message\r\n```\r\nWe use a datatype to represent the configuration of `foo`\r\n```\r\nval _ = Datatype`\r\n  foo_opt = <| input  : mlstring option;\r\n               output : mlstring option;\r\n               help   : bool|>\r\n`;\r\n```\r\n\r\nand write a configuration using the `flag` datatype\r\n\r\n```sml\r\nval foo_conf_def = Define`\r\n  foo_conf = mkArgsConf [(* -i --input *)\r\n                         <| name  := implode \"input\";\r\n                            short := #\"i\";\r\n                            desc  := implode \"Input file to use\";\r\n                            has_option := T; (* It spects an option *)\r\n                            cont := (λarg conf. conf with <|input := arg|>) |>;\r\n                         (* -o --output  *)\r\n                         <| name  := implode \"output\";\r\n                            short := #\"o\";\r\n                            desc  := implode \"Output file\";\r\n                            has_option := T;\r\n                            cont := (λarg conf. conf with <|input := arg|>) |>;\r\n                         (* -h --help *)\r\n                         <| name  := implode \"help\";\r\n                            short := #\"h\";\r\n                            desc  := implode \"This message\";\r\n                            has_option := F;\r\n                            cont := K (λconf. conf with <|help := T|>)|>\r\n                        ]\r\n                  (* Default configuration *)\r\n                  <|input  := NONE;\r\n                    output := NONE;\r\n                    help   := F\r\n                   |>\r\n`;\r\n```\r\n\r\nand then\r\n\r\n```\r\n> EVAL ``parse_conf foo_conf (MAP implode [\"--input\"])``;\r\nval it =\r\n   ⊢ parse_conf foo_conf (MAP implode [\"--input\"]) =\r\n       INL (strlit \"Missing value to: --input\"): thm\r\n\r\n> EVAL ``parse_conf foo_conf (MAP implode [\"--input\";\"text.txt\"])``;\r\nval it =\r\n   ⊢ parse_conf foo_conf (MAP implode [\"--input\"; \"text.txt\"]) =\r\n       INR <|input := SOME (strlit \"text.txt\"); output := NONE; help := F|>:\r\n   thm\r\n\r\n> EVAL ``parse_conf foo_conf (MAP implode [\"--input=in.txt\";\"--output\";\"out.txt\"])``;\r\nval it =\r\n   ⊢ parse_conf foo_conf (MAP implode [\"--input=text.txt\"; \"--output\"; \"out.txt\"]) =\r\n       INR <|input := SOME (strlit \"out.txt\"); output := NONE; help := F|>:\r\n   thm\r\n```\r\nThis is just the core functionality since there are still some quality of life components  missing (help message generation, helper functions, etc).","created_at":"2018-08-15T15:31:54Z","updated_at":"2018-10-29T13:59:03Z","closed_at":"2018-10-29T13:59:03Z","merged_at":null,"merge_commit_sha":"fd0d2a73362f8b7410cf9b3955116cd399448046","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CakeML/cakeml/pulls/511/commits","review_comments_url":"https://api.github.com/repos/CakeML/cakeml/pulls/511/comments","review_comment_url":"https://api.github.com/repos/CakeML/cakeml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CakeML/cakeml/issues/511/comments","statuses_url":"https://api.github.com/repos/CakeML/cakeml/statuses/7ec3d29ad8687ebf32ed1df8b94ad5c70a1036be","head":{"label":"agomezl:argparse","ref":"argparse","sha":"7ec3d29ad8687ebf32ed1df8b94ad5c70a1036be","user":{"login":"agomezl","id":1539099,"node_id":"MDQ6VXNlcjE1MzkwOTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1539099?v=4","gravatar_id":"","url":"https://api.github.com/users/agomezl","html_url":"https://github.com/agomezl","followers_url":"https://api.github.com/users/agomezl/followers","following_url":"https://api.github.com/users/agomezl/following{/other_user}","gists_url":"https://api.github.com/users/agomezl/gists{/gist_id}","starred_url":"https://api.github.com/users/agomezl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agomezl/subscriptions","organizations_url":"https://api.github.com/users/agomezl/orgs","repos_url":"https://api.github.com/users/agomezl/repos","events_url":"https://api.github.com/users/agomezl/events{/privacy}","received_events_url":"https://api.github.com/users/agomezl/received_events","type":"User","site_admin":false},"repo":{"id":103651483,"node_id":"MDEwOlJlcG9zaXRvcnkxMDM2NTE0ODM=","name":"cakeml","full_name":"agomezl/cakeml","private":false,"owner":{"login":"agomezl","id":1539099,"node_id":"MDQ6VXNlcjE1MzkwOTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1539099?v=4","gravatar_id":"","url":"https://api.github.com/users/agomezl","html_url":"https://github.com/agomezl","followers_url":"https://api.github.com/users/agomezl/followers","following_url":"https://api.github.com/users/agomezl/following{/other_user}","gists_url":"https://api.github.com/users/agomezl/gists{/gist_id}","starred_url":"https://api.github.com/users/agomezl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agomezl/subscriptions","organizations_url":"https://api.github.com/users/agomezl/orgs","repos_url":"https://api.github.com/users/agomezl/repos","events_url":"https://api.github.com/users/agomezl/events{/privacy}","received_events_url":"https://api.github.com/users/agomezl/received_events","type":"User","site_admin":false},"html_url":"https://github.com/agomezl/cakeml","description":"CakeML: A Verified Implementation of ML","fork":true,"url":"https://api.github.com/repos/agomezl/cakeml","forks_url":"https://api.github.com/repos/agomezl/cakeml/forks","keys_url":"https://api.github.com/repos/agomezl/cakeml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/agomezl/cakeml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/agomezl/cakeml/teams","hooks_url":"https://api.github.com/repos/agomezl/cakeml/hooks","issue_events_url":"https://api.github.com/repos/agomezl/cakeml/issues/events{/number}","events_url":"https://api.github.com/repos/agomezl/cakeml/events","assignees_url":"https://api.github.com/repos/agomezl/cakeml/assignees{/user}","branches_url":"https://api.github.com/repos/agomezl/cakeml/branches{/branch}","tags_url":"https://api.github.com/repos/agomezl/cakeml/tags","blobs_url":"https://api.github.com/repos/agomezl/cakeml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/agomezl/cakeml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/agomezl/cakeml/git/refs{/sha}","trees_url":"https://api.github.com/repos/agomezl/cakeml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/agomezl/cakeml/statuses/{sha}","languages_url":"https://api.github.com/repos/agomezl/cakeml/languages","stargazers_url":"https://api.github.com/repos/agomezl/cakeml/stargazers","contributors_url":"https://api.github.com/repos/agomezl/cakeml/contributors","subscribers_url":"https://api.github.com/repos/agomezl/cakeml/subscribers","subscription_url":"https://api.github.com/repos/agomezl/cakeml/subscription","commits_url":"https://api.github.com/repos/agomezl/cakeml/commits{/sha}","git_commits_url":"https://api.github.com/repos/agomezl/cakeml/git/commits{/sha}","comments_url":"https://api.github.com/repos/agomezl/cakeml/comments{/number}","issue_comment_url":"https://api.github.com/repos/agomezl/cakeml/issues/comments{/number}","contents_url":"https://api.github.com/repos/agomezl/cakeml/contents/{+path}","compare_url":"https://api.github.com/repos/agomezl/cakeml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/agomezl/cakeml/merges","archive_url":"https://api.github.com/repos/agomezl/cakeml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/agomezl/cakeml/downloads","issues_url":"https://api.github.com/repos/agomezl/cakeml/issues{/number}","pulls_url":"https://api.github.com/repos/agomezl/cakeml/pulls{/number}","milestones_url":"https://api.github.com/repos/agomezl/cakeml/milestones{/number}","notifications_url":"https://api.github.com/repos/agomezl/cakeml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/agomezl/cakeml/labels{/name}","releases_url":"https://api.github.com/repos/agomezl/cakeml/releases{/id}","deployments_url":"https://api.github.com/repos/agomezl/cakeml/deployments","created_at":"2017-09-15T11:52:37Z","updated_at":"2017-09-15T11:52:41Z","pushed_at":"2018-10-29T10:00:51Z","git_url":"git://github.com/agomezl/cakeml.git","ssh_url":"git@github.com:agomezl/cakeml.git","clone_url":"https://github.com/agomezl/cakeml.git","svn_url":"https://github.com/agomezl/cakeml","homepage":"https://cakeml.org","size":65014,"stargazers_count":0,"watchers_count":0,"language":"Standard ML","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CakeML:master","ref":"master","sha":"cc95061c249ee1e7010fa61ef0171faa133fc739","user":{"login":"CakeML","id":8167971,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxNjc5NzE=","avatar_url":"https://avatars0.githubusercontent.com/u/8167971?v=4","gravatar_id":"","url":"https://api.github.com/users/CakeML","html_url":"https://github.com/CakeML","followers_url":"https://api.github.com/users/CakeML/followers","following_url":"https://api.github.com/users/CakeML/following{/other_user}","gists_url":"https://api.github.com/users/CakeML/gists{/gist_id}","starred_url":"https://api.github.com/users/CakeML/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CakeML/subscriptions","organizations_url":"https://api.github.com/users/CakeML/orgs","repos_url":"https://api.github.com/users/CakeML/repos","events_url":"https://api.github.com/users/CakeML/events{/privacy}","received_events_url":"https://api.github.com/users/CakeML/received_events","type":"Organization","site_admin":false},"repo":{"id":6138801,"node_id":"MDEwOlJlcG9zaXRvcnk2MTM4ODAx","name":"cakeml","full_name":"CakeML/cakeml","private":false,"owner":{"login":"CakeML","id":8167971,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxNjc5NzE=","avatar_url":"https://avatars0.githubusercontent.com/u/8167971?v=4","gravatar_id":"","url":"https://api.github.com/users/CakeML","html_url":"https://github.com/CakeML","followers_url":"https://api.github.com/users/CakeML/followers","following_url":"https://api.github.com/users/CakeML/following{/other_user}","gists_url":"https://api.github.com/users/CakeML/gists{/gist_id}","starred_url":"https://api.github.com/users/CakeML/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CakeML/subscriptions","organizations_url":"https://api.github.com/users/CakeML/orgs","repos_url":"https://api.github.com/users/CakeML/repos","events_url":"https://api.github.com/users/CakeML/events{/privacy}","received_events_url":"https://api.github.com/users/CakeML/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/CakeML/cakeml","description":"CakeML: A Verified Implementation of ML","fork":false,"url":"https://api.github.com/repos/CakeML/cakeml","forks_url":"https://api.github.com/repos/CakeML/cakeml/forks","keys_url":"https://api.github.com/repos/CakeML/cakeml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CakeML/cakeml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CakeML/cakeml/teams","hooks_url":"https://api.github.com/repos/CakeML/cakeml/hooks","issue_events_url":"https://api.github.com/repos/CakeML/cakeml/issues/events{/number}","events_url":"https://api.github.com/repos/CakeML/cakeml/events","assignees_url":"https://api.github.com/repos/CakeML/cakeml/assignees{/user}","branches_url":"https://api.github.com/repos/CakeML/cakeml/branches{/branch}","tags_url":"https://api.github.com/repos/CakeML/cakeml/tags","blobs_url":"https://api.github.com/repos/CakeML/cakeml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CakeML/cakeml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CakeML/cakeml/git/refs{/sha}","trees_url":"https://api.github.com/repos/CakeML/cakeml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CakeML/cakeml/statuses/{sha}","languages_url":"https://api.github.com/repos/CakeML/cakeml/languages","stargazers_url":"https://api.github.com/repos/CakeML/cakeml/stargazers","contributors_url":"https://api.github.com/repos/CakeML/cakeml/contributors","subscribers_url":"https://api.github.com/repos/CakeML/cakeml/subscribers","subscription_url":"https://api.github.com/repos/CakeML/cakeml/subscription","commits_url":"https://api.github.com/repos/CakeML/cakeml/commits{/sha}","git_commits_url":"https://api.github.com/repos/CakeML/cakeml/git/commits{/sha}","comments_url":"https://api.github.com/repos/CakeML/cakeml/comments{/number}","issue_comment_url":"https://api.github.com/repos/CakeML/cakeml/issues/comments{/number}","contents_url":"https://api.github.com/repos/CakeML/cakeml/contents/{+path}","compare_url":"https://api.github.com/repos/CakeML/cakeml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CakeML/cakeml/merges","archive_url":"https://api.github.com/repos/CakeML/cakeml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CakeML/cakeml/downloads","issues_url":"https://api.github.com/repos/CakeML/cakeml/issues{/number}","pulls_url":"https://api.github.com/repos/CakeML/cakeml/pulls{/number}","milestones_url":"https://api.github.com/repos/CakeML/cakeml/milestones{/number}","notifications_url":"https://api.github.com/repos/CakeML/cakeml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CakeML/cakeml/labels{/name}","releases_url":"https://api.github.com/repos/CakeML/cakeml/releases{/id}","deployments_url":"https://api.github.com/repos/CakeML/cakeml/deployments","created_at":"2012-10-09T10:13:51Z","updated_at":"2018-10-26T02:47:47Z","pushed_at":"2018-10-29T13:35:25Z","git_url":"git://github.com/CakeML/cakeml.git","ssh_url":"git@github.com:CakeML/cakeml.git","clone_url":"https://github.com/CakeML/cakeml.git","svn_url":"https://github.com/CakeML/cakeml","homepage":"https://cakeml.org","size":67407,"stargazers_count":381,"watchers_count":381,"language":"Standard ML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"archived":false,"open_issues_count":101,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":39,"open_issues":101,"watchers":381,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CakeML/cakeml/pulls/511"},"html":{"href":"https://github.com/CakeML/cakeml/pull/511"},"issue":{"href":"https://api.github.com/repos/CakeML/cakeml/issues/511"},"comments":{"href":"https://api.github.com/repos/CakeML/cakeml/issues/511/comments"},"review_comments":{"href":"https://api.github.com/repos/CakeML/cakeml/pulls/511/comments"},"review_comment":{"href":"https://api.github.com/repos/CakeML/cakeml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CakeML/cakeml/pulls/511/commits"},"statuses":{"href":"https://api.github.com/repos/CakeML/cakeml/statuses/7ec3d29ad8687ebf32ed1df8b94ad5c70a1036be"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":true,"rebaseable":false,"mergeable_state":"unstable","merged_by":null,"comments":18,"review_comments":0,"maintainer_can_modify":false,"commits":12,"additions":615,"deletions":50,"changed_files":11}}
{"actor":{"display_login":"xrchz"}}