{"action":"created","comment":{"url":"https://api.github.com/repos/snabbco/snabb/pulls/comments/79446491","id":79446491,"diff_hunk":"@@ -34,11 +34,8 @@ end\n \n PcapWriter = {}\n \n-function PcapWriter:new (filename, arg)\n-   local conf = arg and config.parse_app_arg(arg) or {}\n-   local mode = conf.overwrite and \"w+\" or \"w\"\n-   local file, errno = io.open(filename, mode)\n-   if errno then error(errno) end\n+function PcapWriter:new (filename)\n+   local file = assert(io.open(filename, \"w\"))","path":"src/apps/pcap/pcap.lua","position":10,"original_position":10,"commit_id":"53bc9ac4621067f6857e5bdafa2b9945bc70f2a7","original_commit_id":"53bc9ac4621067f6857e5bdafa2b9945bc70f2a7","user":{"login":"dpino","id":11567,"avatar_url":"https://avatars.githubusercontent.com/u/11567?v=3","gravatar_id":"","url":"https://api.github.com/users/dpino","html_url":"https://github.com/dpino","followers_url":"https://api.github.com/users/dpino/followers","following_url":"https://api.github.com/users/dpino/following{/other_user}","gists_url":"https://api.github.com/users/dpino/gists{/gist_id}","starred_url":"https://api.github.com/users/dpino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpino/subscriptions","organizations_url":"https://api.github.com/users/dpino/orgs","repos_url":"https://api.github.com/users/dpino/repos","events_url":"https://api.github.com/users/dpino/events{/privacy}","received_events_url":"https://api.github.com/users/dpino/received_events","type":"User","site_admin":false},"body":"@eugenia That would work for me :+1: ","created_at":"2016-09-19T17:39:34Z","updated_at":"2016-09-19T17:39:34Z","html_url":"https://github.com/snabbco/snabb/pull/1019#discussion_r79446491","pull_request_url":"https://api.github.com/repos/snabbco/snabb/pulls/1019","_links":{"self":{"href":"https://api.github.com/repos/snabbco/snabb/pulls/comments/79446491"},"html":{"href":"https://github.com/snabbco/snabb/pull/1019#discussion_r79446491"},"pull_request":{"href":"https://api.github.com/repos/snabbco/snabb/pulls/1019"}}},"pull_request":{"url":"https://api.github.com/repos/snabbco/snabb/pulls/1019","id":84492422,"html_url":"https://github.com/snabbco/snabb/pull/1019","diff_url":"https://github.com/snabbco/snabb/pull/1019.diff","patch_url":"https://github.com/snabbco/snabb/pull/1019.patch","issue_url":"https://api.github.com/repos/snabbco/snabb/issues/1019","number":1019,"state":"open","locked":false,"title":"config.app: parse app args","user":{"login":"eugeneia","id":4933566,"avatar_url":"https://avatars.githubusercontent.com/u/4933566?v=3","gravatar_id":"","url":"https://api.github.com/users/eugeneia","html_url":"https://github.com/eugeneia","followers_url":"https://api.github.com/users/eugeneia/followers","following_url":"https://api.github.com/users/eugeneia/following{/other_user}","gists_url":"https://api.github.com/users/eugeneia/gists{/gist_id}","starred_url":"https://api.github.com/users/eugeneia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugeneia/subscriptions","organizations_url":"https://api.github.com/users/eugeneia/orgs","repos_url":"https://api.github.com/users/eugeneia/repos","events_url":"https://api.github.com/users/eugeneia/events{/privacy}","received_events_url":"https://api.github.com/users/eugeneia/received_events","type":"User","site_admin":false},"body":"This PR addresses two issues:\r\n- awkward `lib.parse_app_arg` dance in the constructor of many apps\r\n- proper app arg validation and errors in case of missing mandatory arguments and undefined arguments\r\n\r\nTo fix this a `parse` function (adapted from #797) is added to `core.lib`, and `config.app` will use this function to parse app args when `appclass.config` is set.\r\n\r\nExample:\r\n\r\n```\r\nMyApp = {\r\n   config = {\r\n      a = {required=true},\r\n      b = {default=42}\r\n   }\r\n}\r\n\r\nlocal c = config.new()\r\nconfig.app(c, \"valid\", MyApp, {a=\"foo\"}) => MyApp:new({a=\"foo\", b=42})\r\nconfig.app(c, \"valid\", MyApp) => error\r\nconfig.app(c, \"valid\", MyApp, {a=\"foo\", c=\"bar\"}) => error\r\n```\r\n\r\nThis supersedes #797, and provides a tightly integrated version thereof.\r\n\r\nDepends on: #1008 ","created_at":"2016-09-08T14:49:45Z","updated_at":"2016-09-19T17:39:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"45a748df1283d032afa15308af750419d96c9bb4","assignee":{"login":"kbara","id":1588250,"avatar_url":"https://avatars.githubusercontent.com/u/1588250?v=3","gravatar_id":"","url":"https://api.github.com/users/kbara","html_url":"https://github.com/kbara","followers_url":"https://api.github.com/users/kbara/followers","following_url":"https://api.github.com/users/kbara/following{/other_user}","gists_url":"https://api.github.com/users/kbara/gists{/gist_id}","starred_url":"https://api.github.com/users/kbara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbara/subscriptions","organizations_url":"https://api.github.com/users/kbara/orgs","repos_url":"https://api.github.com/users/kbara/repos","events_url":"https://api.github.com/users/kbara/events{/privacy}","received_events_url":"https://api.github.com/users/kbara/received_events","type":"User","site_admin":false},"assignees":[{"login":"kbara","id":1588250,"avatar_url":"https://avatars.githubusercontent.com/u/1588250?v=3","gravatar_id":"","url":"https://api.github.com/users/kbara","html_url":"https://github.com/kbara","followers_url":"https://api.github.com/users/kbara/followers","following_url":"https://api.github.com/users/kbara/following{/other_user}","gists_url":"https://api.github.com/users/kbara/gists{/gist_id}","starred_url":"https://api.github.com/users/kbara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbara/subscriptions","organizations_url":"https://api.github.com/users/kbara/orgs","repos_url":"https://api.github.com/users/kbara/repos","events_url":"https://api.github.com/users/kbara/events{/privacy}","received_events_url":"https://api.github.com/users/kbara/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/snabbco/snabb/pulls/1019/commits","review_comments_url":"https://api.github.com/repos/snabbco/snabb/pulls/1019/comments","review_comment_url":"https://api.github.com/repos/snabbco/snabb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snabbco/snabb/issues/1019/comments","statuses_url":"https://api.github.com/repos/snabbco/snabb/statuses/53bc9ac4621067f6857e5bdafa2b9945bc70f2a7","head":{"label":"eugeneia:parse-app-config","ref":"parse-app-config","sha":"53bc9ac4621067f6857e5bdafa2b9945bc70f2a7","user":{"login":"eugeneia","id":4933566,"avatar_url":"https://avatars.githubusercontent.com/u/4933566?v=3","gravatar_id":"","url":"https://api.github.com/users/eugeneia","html_url":"https://github.com/eugeneia","followers_url":"https://api.github.com/users/eugeneia/followers","following_url":"https://api.github.com/users/eugeneia/following{/other_user}","gists_url":"https://api.github.com/users/eugeneia/gists{/gist_id}","starred_url":"https://api.github.com/users/eugeneia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugeneia/subscriptions","organizations_url":"https://api.github.com/users/eugeneia/orgs","repos_url":"https://api.github.com/users/eugeneia/repos","events_url":"https://api.github.com/users/eugeneia/events{/privacy}","received_events_url":"https://api.github.com/users/eugeneia/received_events","type":"User","site_admin":false},"repo":{"id":20404812,"name":"snabb","full_name":"eugeneia/snabb","owner":{"login":"eugeneia","id":4933566,"avatar_url":"https://avatars.githubusercontent.com/u/4933566?v=3","gravatar_id":"","url":"https://api.github.com/users/eugeneia","html_url":"https://github.com/eugeneia","followers_url":"https://api.github.com/users/eugeneia/followers","following_url":"https://api.github.com/users/eugeneia/following{/other_user}","gists_url":"https://api.github.com/users/eugeneia/gists{/gist_id}","starred_url":"https://api.github.com/users/eugeneia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugeneia/subscriptions","organizations_url":"https://api.github.com/users/eugeneia/orgs","repos_url":"https://api.github.com/users/eugeneia/repos","events_url":"https://api.github.com/users/eugeneia/events{/privacy}","received_events_url":"https://api.github.com/users/eugeneia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eugeneia/snabb","description":" Snabb: Simple and fast packet networking","fork":true,"url":"https://api.github.com/repos/eugeneia/snabb","forks_url":"https://api.github.com/repos/eugeneia/snabb/forks","keys_url":"https://api.github.com/repos/eugeneia/snabb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eugeneia/snabb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eugeneia/snabb/teams","hooks_url":"https://api.github.com/repos/eugeneia/snabb/hooks","issue_events_url":"https://api.github.com/repos/eugeneia/snabb/issues/events{/number}","events_url":"https://api.github.com/repos/eugeneia/snabb/events","assignees_url":"https://api.github.com/repos/eugeneia/snabb/assignees{/user}","branches_url":"https://api.github.com/repos/eugeneia/snabb/branches{/branch}","tags_url":"https://api.github.com/repos/eugeneia/snabb/tags","blobs_url":"https://api.github.com/repos/eugeneia/snabb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eugeneia/snabb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eugeneia/snabb/git/refs{/sha}","trees_url":"https://api.github.com/repos/eugeneia/snabb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eugeneia/snabb/statuses/{sha}","languages_url":"https://api.github.com/repos/eugeneia/snabb/languages","stargazers_url":"https://api.github.com/repos/eugeneia/snabb/stargazers","contributors_url":"https://api.github.com/repos/eugeneia/snabb/contributors","subscribers_url":"https://api.github.com/repos/eugeneia/snabb/subscribers","subscription_url":"https://api.github.com/repos/eugeneia/snabb/subscription","commits_url":"https://api.github.com/repos/eugeneia/snabb/commits{/sha}","git_commits_url":"https://api.github.com/repos/eugeneia/snabb/git/commits{/sha}","comments_url":"https://api.github.com/repos/eugeneia/snabb/comments{/number}","issue_comment_url":"https://api.github.com/repos/eugeneia/snabb/issues/comments{/number}","contents_url":"https://api.github.com/repos/eugeneia/snabb/contents/{+path}","compare_url":"https://api.github.com/repos/eugeneia/snabb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eugeneia/snabb/merges","archive_url":"https://api.github.com/repos/eugeneia/snabb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eugeneia/snabb/downloads","issues_url":"https://api.github.com/repos/eugeneia/snabb/issues{/number}","pulls_url":"https://api.github.com/repos/eugeneia/snabb/pulls{/number}","milestones_url":"https://api.github.com/repos/eugeneia/snabb/milestones{/number}","notifications_url":"https://api.github.com/repos/eugeneia/snabb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eugeneia/snabb/labels{/name}","releases_url":"https://api.github.com/repos/eugeneia/snabb/releases{/id}","deployments_url":"https://api.github.com/repos/eugeneia/snabb/deployments","created_at":"2014-06-02T13:29:12Z","updated_at":"2016-05-20T15:40:31Z","pushed_at":"2016-09-12T15:04:34Z","git_url":"git://github.com/eugeneia/snabb.git","ssh_url":"git@github.com:eugeneia/snabb.git","clone_url":"https://github.com/eugeneia/snabb.git","svn_url":"https://github.com/eugeneia/snabb","homepage":"","size":7335,"stargazers_count":3,"watchers_count":3,"language":"Lua","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"snabbco:master","ref":"master","sha":"b7d6d77ba5fd6a6b9306f92466c1779bba2caa31","user":{"login":"snabbco","id":1913310,"avatar_url":"https://avatars.githubusercontent.com/u/1913310?v=3","gravatar_id":"","url":"https://api.github.com/users/snabbco","html_url":"https://github.com/snabbco","followers_url":"https://api.github.com/users/snabbco/followers","following_url":"https://api.github.com/users/snabbco/following{/other_user}","gists_url":"https://api.github.com/users/snabbco/gists{/gist_id}","starred_url":"https://api.github.com/users/snabbco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snabbco/subscriptions","organizations_url":"https://api.github.com/users/snabbco/orgs","repos_url":"https://api.github.com/users/snabbco/repos","events_url":"https://api.github.com/users/snabbco/events{/privacy}","received_events_url":"https://api.github.com/users/snabbco/received_events","type":"Organization","site_admin":false},"repo":{"id":4857740,"name":"snabb","full_name":"snabbco/snabb","owner":{"login":"snabbco","id":1913310,"avatar_url":"https://avatars.githubusercontent.com/u/1913310?v=3","gravatar_id":"","url":"https://api.github.com/users/snabbco","html_url":"https://github.com/snabbco","followers_url":"https://api.github.com/users/snabbco/followers","following_url":"https://api.github.com/users/snabbco/following{/other_user}","gists_url":"https://api.github.com/users/snabbco/gists{/gist_id}","starred_url":"https://api.github.com/users/snabbco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snabbco/subscriptions","organizations_url":"https://api.github.com/users/snabbco/orgs","repos_url":"https://api.github.com/users/snabbco/repos","events_url":"https://api.github.com/users/snabbco/events{/privacy}","received_events_url":"https://api.github.com/users/snabbco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/snabbco/snabb","description":"Snabb: Simple and fast packet networking","fork":false,"url":"https://api.github.com/repos/snabbco/snabb","forks_url":"https://api.github.com/repos/snabbco/snabb/forks","keys_url":"https://api.github.com/repos/snabbco/snabb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snabbco/snabb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snabbco/snabb/teams","hooks_url":"https://api.github.com/repos/snabbco/snabb/hooks","issue_events_url":"https://api.github.com/repos/snabbco/snabb/issues/events{/number}","events_url":"https://api.github.com/repos/snabbco/snabb/events","assignees_url":"https://api.github.com/repos/snabbco/snabb/assignees{/user}","branches_url":"https://api.github.com/repos/snabbco/snabb/branches{/branch}","tags_url":"https://api.github.com/repos/snabbco/snabb/tags","blobs_url":"https://api.github.com/repos/snabbco/snabb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snabbco/snabb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snabbco/snabb/git/refs{/sha}","trees_url":"https://api.github.com/repos/snabbco/snabb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snabbco/snabb/statuses/{sha}","languages_url":"https://api.github.com/repos/snabbco/snabb/languages","stargazers_url":"https://api.github.com/repos/snabbco/snabb/stargazers","contributors_url":"https://api.github.com/repos/snabbco/snabb/contributors","subscribers_url":"https://api.github.com/repos/snabbco/snabb/subscribers","subscription_url":"https://api.github.com/repos/snabbco/snabb/subscription","commits_url":"https://api.github.com/repos/snabbco/snabb/commits{/sha}","git_commits_url":"https://api.github.com/repos/snabbco/snabb/git/commits{/sha}","comments_url":"https://api.github.com/repos/snabbco/snabb/comments{/number}","issue_comment_url":"https://api.github.com/repos/snabbco/snabb/issues/comments{/number}","contents_url":"https://api.github.com/repos/snabbco/snabb/contents/{+path}","compare_url":"https://api.github.com/repos/snabbco/snabb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snabbco/snabb/merges","archive_url":"https://api.github.com/repos/snabbco/snabb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snabbco/snabb/downloads","issues_url":"https://api.github.com/repos/snabbco/snabb/issues{/number}","pulls_url":"https://api.github.com/repos/snabbco/snabb/pulls{/number}","milestones_url":"https://api.github.com/repos/snabbco/snabb/milestones{/number}","notifications_url":"https://api.github.com/repos/snabbco/snabb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snabbco/snabb/labels{/name}","releases_url":"https://api.github.com/repos/snabbco/snabb/releases{/id}","deployments_url":"https://api.github.com/repos/snabbco/snabb/deployments","created_at":"2012-07-02T09:06:38Z","updated_at":"2016-09-19T12:50:06Z","pushed_at":"2016-09-19T14:56:04Z","git_url":"git://github.com/snabbco/snabb.git","ssh_url":"git@github.com:snabbco/snabb.git","clone_url":"https://github.com/snabbco/snabb.git","svn_url":"https://github.com/snabbco/snabb","homepage":"","size":11596,"stargazers_count":1467,"watchers_count":1467,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":187,"mirror_url":null,"open_issues_count":123,"forks":187,"open_issues":123,"watchers":1467,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snabbco/snabb/pulls/1019"},"html":{"href":"https://github.com/snabbco/snabb/pull/1019"},"issue":{"href":"https://api.github.com/repos/snabbco/snabb/issues/1019"},"comments":{"href":"https://api.github.com/repos/snabbco/snabb/issues/1019/comments"},"review_comments":{"href":"https://api.github.com/repos/snabbco/snabb/pulls/1019/comments"},"review_comment":{"href":"https://api.github.com/repos/snabbco/snabb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snabbco/snabb/pulls/1019/commits"},"statuses":{"href":"https://api.github.com/repos/snabbco/snabb/statuses/53bc9ac4621067f6857e5bdafa2b9945bc70f2a7"}}}}
{"actor":{"display_login":"dpino"}}