{"action":"created","comment":{"url":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/comments/244557925","pull_request_review_id":188465093,"id":244557925,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NDU1NzkyNQ==","diff_hunk":"@@ -47,288 +39,48 @@ const (\n \texecutableMask = 0111\n )\n \n-var (\n-\t// Error parsing nic config\n-\tparseNicConfigError = errors.New(\"NIC config wasn't of the form DEVICE/MACADDR\")\n-\n-\t// error parsing blockdevices\n-\tinvalidDriveSpecificationNoSuffix = errors.New(\"invalid drive specification. Must have :rw or :ro suffix\")\n-\tinvalidDriveSpecificationNoPath   = errors.New(\"invalid drive specification. Must have path\")\n-\n-\t// error parsing vsock\n-\tunableToParseVsockDevices = errors.New(\"unable to parse vsock devices\")\n-\tunableToParseVsockCID     = errors.New(\"unable to parse vsock CID as a number\")\n-)\n-\n-func parseBlockDevices(entries []string) ([]models.Drive, error) {\n-\tdevices := []models.Drive{}\n-\n-\tfor i, entry := range entries {\n-\t\tpath := \"\"\n-\t\treadOnly := true\n-\n-\t\tif strings.HasSuffix(entry, \":rw\") {\n-\t\t\treadOnly = false\n-\t\t\tpath = strings.TrimSuffix(entry, \":rw\")\n-\t\t} else if strings.HasSuffix(entry, \":ro\") {\n-\t\t\tpath = strings.TrimSuffix(entry, \":ro\")\n+func main() {\n+\topts := options{}\n+\tp := flags.NewParser(&opts, flags.Default)\n+\t// if no args just print help\n+\tif len(os.Args) == 1 {\n+\t\tp.WriteHelp(os.Stderr)\n+\t\tos.Exit(0)\n+\t}\n+\t_, err := p.ParseArgs(os.Args)\n+\tif err != nil {\n+\t\t// ErrHelp indicates that the help message was printed so we\n+\t\t// can exit\n+\t\tif val, ok := err.(*flags.Error); ok && val.Type == flags.ErrHelp {\n+\t\t\tos.Exit(0)\n \t\t} else {","path":"main.go","position":65,"original_position":65,"commit_id":"3e81efa490b3b2dcbd909ca64ce1135269092feb","original_commit_id":"3e81efa490b3b2dcbd909ca64ce1135269092feb","user":{"login":"xibz","id":1964445,"node_id":"MDQ6VXNlcjE5NjQ0NDU=","avatar_url":"https://avatars0.githubusercontent.com/u/1964445?v=4","gravatar_id":"","url":"https://api.github.com/users/xibz","html_url":"https://github.com/xibz","followers_url":"https://api.github.com/users/xibz/followers","following_url":"https://api.github.com/users/xibz/following{/other_user}","gists_url":"https://api.github.com/users/xibz/gists{/gist_id}","starred_url":"https://api.github.com/users/xibz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xibz/subscriptions","organizations_url":"https://api.github.com/users/xibz/orgs","repos_url":"https://api.github.com/users/xibz/repos","events_url":"https://api.github.com/users/xibz/events{/privacy}","received_events_url":"https://api.github.com/users/xibz/received_events","type":"User","site_admin":false},"body":"nit: else statement isn't needed\r\n\r\n```go\r\nif val, ok := err.(*flags.Error); ok && val.Type == flags.ErrHelp {\r\n    os.Exit(0)\r\n}\r\n\r\np.WriteHelp(os.Stderr)\r\nos.Exit(1)\r\n```","created_at":"2018-12-31T06:56:41Z","updated_at":"2018-12-31T06:57:59Z","html_url":"https://github.com/firecracker-microvm/firectl/pull/6#discussion_r244557925","pull_request_url":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/6","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/comments/244557925"},"html":{"href":"https://github.com/firecracker-microvm/firectl/pull/6#discussion_r244557925"},"pull_request":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/6","id":241248240,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxMjQ4MjQw","html_url":"https://github.com/firecracker-microvm/firectl/pull/6","diff_url":"https://github.com/firecracker-microvm/firectl/pull/6.diff","patch_url":"https://github.com/firecracker-microvm/firectl/pull/6.patch","issue_url":"https://api.github.com/repos/firecracker-microvm/firectl/issues/6","number":6,"state":"open","locked":false,"title":"WIP: Refactor and add unit tests","user":{"login":"IRCody","id":4969568,"node_id":"MDQ6VXNlcjQ5Njk1Njg=","avatar_url":"https://avatars1.githubusercontent.com/u/4969568?v=4","gravatar_id":"","url":"https://api.github.com/users/IRCody","html_url":"https://github.com/IRCody","followers_url":"https://api.github.com/users/IRCody/followers","following_url":"https://api.github.com/users/IRCody/following{/other_user}","gists_url":"https://api.github.com/users/IRCody/gists{/gist_id}","starred_url":"https://api.github.com/users/IRCody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IRCody/subscriptions","organizations_url":"https://api.github.com/users/IRCody/orgs","repos_url":"https://api.github.com/users/IRCody/repos","events_url":"https://api.github.com/users/IRCody/events{/privacy}","received_events_url":"https://api.github.com/users/IRCody/received_events","type":"User","site_admin":false},"body":"*Description of changes:*\r\n\r\nRefactors the code and adds unit test to improve test coverage. \r\n\r\nBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.\r\n","created_at":"2018-12-28T01:31:37Z","updated_at":"2018-12-31T06:57:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed974147c835caed44157dde6043feaf549c7073","assignee":null,"assignees":[],"requested_reviewers":[{"login":"nmeyerhans","id":621967,"node_id":"MDQ6VXNlcjYyMTk2Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/621967?v=4","gravatar_id":"","url":"https://api.github.com/users/nmeyerhans","html_url":"https://github.com/nmeyerhans","followers_url":"https://api.github.com/users/nmeyerhans/followers","following_url":"https://api.github.com/users/nmeyerhans/following{/other_user}","gists_url":"https://api.github.com/users/nmeyerhans/gists{/gist_id}","starred_url":"https://api.github.com/users/nmeyerhans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmeyerhans/subscriptions","organizations_url":"https://api.github.com/users/nmeyerhans/orgs","repos_url":"https://api.github.com/users/nmeyerhans/repos","events_url":"https://api.github.com/users/nmeyerhans/events{/privacy}","received_events_url":"https://api.github.com/users/nmeyerhans/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/6/commits","review_comments_url":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/6/comments","review_comment_url":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/firecracker-microvm/firectl/issues/6/comments","statuses_url":"https://api.github.com/repos/firecracker-microvm/firectl/statuses/3e81efa490b3b2dcbd909ca64ce1135269092feb","head":{"label":"IRCody:test_refactor","ref":"test_refactor","sha":"3e81efa490b3b2dcbd909ca64ce1135269092feb","user":{"login":"IRCody","id":4969568,"node_id":"MDQ6VXNlcjQ5Njk1Njg=","avatar_url":"https://avatars1.githubusercontent.com/u/4969568?v=4","gravatar_id":"","url":"https://api.github.com/users/IRCody","html_url":"https://github.com/IRCody","followers_url":"https://api.github.com/users/IRCody/followers","following_url":"https://api.github.com/users/IRCody/following{/other_user}","gists_url":"https://api.github.com/users/IRCody/gists{/gist_id}","starred_url":"https://api.github.com/users/IRCody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IRCody/subscriptions","organizations_url":"https://api.github.com/users/IRCody/orgs","repos_url":"https://api.github.com/users/IRCody/repos","events_url":"https://api.github.com/users/IRCody/events{/privacy}","received_events_url":"https://api.github.com/users/IRCody/received_events","type":"User","site_admin":false},"repo":{"id":162772026,"node_id":"MDEwOlJlcG9zaXRvcnkxNjI3NzIwMjY=","name":"firectl","full_name":"IRCody/firectl","private":false,"owner":{"login":"IRCody","id":4969568,"node_id":"MDQ6VXNlcjQ5Njk1Njg=","avatar_url":"https://avatars1.githubusercontent.com/u/4969568?v=4","gravatar_id":"","url":"https://api.github.com/users/IRCody","html_url":"https://github.com/IRCody","followers_url":"https://api.github.com/users/IRCody/followers","following_url":"https://api.github.com/users/IRCody/following{/other_user}","gists_url":"https://api.github.com/users/IRCody/gists{/gist_id}","starred_url":"https://api.github.com/users/IRCody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IRCody/subscriptions","organizations_url":"https://api.github.com/users/IRCody/orgs","repos_url":"https://api.github.com/users/IRCody/repos","events_url":"https://api.github.com/users/IRCody/events{/privacy}","received_events_url":"https://api.github.com/users/IRCody/received_events","type":"User","site_admin":false},"html_url":"https://github.com/IRCody/firectl","description":"firectl is a command-line tool to run Firecracker microVMs","fork":true,"url":"https://api.github.com/repos/IRCody/firectl","forks_url":"https://api.github.com/repos/IRCody/firectl/forks","keys_url":"https://api.github.com/repos/IRCody/firectl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IRCody/firectl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IRCody/firectl/teams","hooks_url":"https://api.github.com/repos/IRCody/firectl/hooks","issue_events_url":"https://api.github.com/repos/IRCody/firectl/issues/events{/number}","events_url":"https://api.github.com/repos/IRCody/firectl/events","assignees_url":"https://api.github.com/repos/IRCody/firectl/assignees{/user}","branches_url":"https://api.github.com/repos/IRCody/firectl/branches{/branch}","tags_url":"https://api.github.com/repos/IRCody/firectl/tags","blobs_url":"https://api.github.com/repos/IRCody/firectl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IRCody/firectl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IRCody/firectl/git/refs{/sha}","trees_url":"https://api.github.com/repos/IRCody/firectl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IRCody/firectl/statuses/{sha}","languages_url":"https://api.github.com/repos/IRCody/firectl/languages","stargazers_url":"https://api.github.com/repos/IRCody/firectl/stargazers","contributors_url":"https://api.github.com/repos/IRCody/firectl/contributors","subscribers_url":"https://api.github.com/repos/IRCody/firectl/subscribers","subscription_url":"https://api.github.com/repos/IRCody/firectl/subscription","commits_url":"https://api.github.com/repos/IRCody/firectl/commits{/sha}","git_commits_url":"https://api.github.com/repos/IRCody/firectl/git/commits{/sha}","comments_url":"https://api.github.com/repos/IRCody/firectl/comments{/number}","issue_comment_url":"https://api.github.com/repos/IRCody/firectl/issues/comments{/number}","contents_url":"https://api.github.com/repos/IRCody/firectl/contents/{+path}","compare_url":"https://api.github.com/repos/IRCody/firectl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IRCody/firectl/merges","archive_url":"https://api.github.com/repos/IRCody/firectl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IRCody/firectl/downloads","issues_url":"https://api.github.com/repos/IRCody/firectl/issues{/number}","pulls_url":"https://api.github.com/repos/IRCody/firectl/pulls{/number}","milestones_url":"https://api.github.com/repos/IRCody/firectl/milestones{/number}","notifications_url":"https://api.github.com/repos/IRCody/firectl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IRCody/firectl/labels{/name}","releases_url":"https://api.github.com/repos/IRCody/firectl/releases{/id}","deployments_url":"https://api.github.com/repos/IRCody/firectl/deployments","created_at":"2018-12-22T01:27:01Z","updated_at":"2018-12-22T01:27:03Z","pushed_at":"2018-12-28T22:25:27Z","git_url":"git://github.com/IRCody/firectl.git","ssh_url":"git@github.com:IRCody/firectl.git","clone_url":"https://github.com/IRCody/firectl.git","svn_url":"https://github.com/IRCody/firectl","homepage":null,"size":32,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"firecracker-microvm:master","ref":"master","sha":"687766d53030e1631ef1881bd45e4a58f5ca8824","user":{"login":"firecracker-microvm","id":44477506,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NDc3NTA2","avatar_url":"https://avatars0.githubusercontent.com/u/44477506?v=4","gravatar_id":"","url":"https://api.github.com/users/firecracker-microvm","html_url":"https://github.com/firecracker-microvm","followers_url":"https://api.github.com/users/firecracker-microvm/followers","following_url":"https://api.github.com/users/firecracker-microvm/following{/other_user}","gists_url":"https://api.github.com/users/firecracker-microvm/gists{/gist_id}","starred_url":"https://api.github.com/users/firecracker-microvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firecracker-microvm/subscriptions","organizations_url":"https://api.github.com/users/firecracker-microvm/orgs","repos_url":"https://api.github.com/users/firecracker-microvm/repos","events_url":"https://api.github.com/users/firecracker-microvm/events{/privacy}","received_events_url":"https://api.github.com/users/firecracker-microvm/received_events","type":"Organization","site_admin":false},"repo":{"id":160432801,"node_id":"MDEwOlJlcG9zaXRvcnkxNjA0MzI4MDE=","name":"firectl","full_name":"firecracker-microvm/firectl","private":false,"owner":{"login":"firecracker-microvm","id":44477506,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NDc3NTA2","avatar_url":"https://avatars0.githubusercontent.com/u/44477506?v=4","gravatar_id":"","url":"https://api.github.com/users/firecracker-microvm","html_url":"https://github.com/firecracker-microvm","followers_url":"https://api.github.com/users/firecracker-microvm/followers","following_url":"https://api.github.com/users/firecracker-microvm/following{/other_user}","gists_url":"https://api.github.com/users/firecracker-microvm/gists{/gist_id}","starred_url":"https://api.github.com/users/firecracker-microvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firecracker-microvm/subscriptions","organizations_url":"https://api.github.com/users/firecracker-microvm/orgs","repos_url":"https://api.github.com/users/firecracker-microvm/repos","events_url":"https://api.github.com/users/firecracker-microvm/events{/privacy}","received_events_url":"https://api.github.com/users/firecracker-microvm/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/firecracker-microvm/firectl","description":"firectl is a command-line tool to run Firecracker microVMs","fork":false,"url":"https://api.github.com/repos/firecracker-microvm/firectl","forks_url":"https://api.github.com/repos/firecracker-microvm/firectl/forks","keys_url":"https://api.github.com/repos/firecracker-microvm/firectl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firecracker-microvm/firectl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firecracker-microvm/firectl/teams","hooks_url":"https://api.github.com/repos/firecracker-microvm/firectl/hooks","issue_events_url":"https://api.github.com/repos/firecracker-microvm/firectl/issues/events{/number}","events_url":"https://api.github.com/repos/firecracker-microvm/firectl/events","assignees_url":"https://api.github.com/repos/firecracker-microvm/firectl/assignees{/user}","branches_url":"https://api.github.com/repos/firecracker-microvm/firectl/branches{/branch}","tags_url":"https://api.github.com/repos/firecracker-microvm/firectl/tags","blobs_url":"https://api.github.com/repos/firecracker-microvm/firectl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firecracker-microvm/firectl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firecracker-microvm/firectl/git/refs{/sha}","trees_url":"https://api.github.com/repos/firecracker-microvm/firectl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firecracker-microvm/firectl/statuses/{sha}","languages_url":"https://api.github.com/repos/firecracker-microvm/firectl/languages","stargazers_url":"https://api.github.com/repos/firecracker-microvm/firectl/stargazers","contributors_url":"https://api.github.com/repos/firecracker-microvm/firectl/contributors","subscribers_url":"https://api.github.com/repos/firecracker-microvm/firectl/subscribers","subscription_url":"https://api.github.com/repos/firecracker-microvm/firectl/subscription","commits_url":"https://api.github.com/repos/firecracker-microvm/firectl/commits{/sha}","git_commits_url":"https://api.github.com/repos/firecracker-microvm/firectl/git/commits{/sha}","comments_url":"https://api.github.com/repos/firecracker-microvm/firectl/comments{/number}","issue_comment_url":"https://api.github.com/repos/firecracker-microvm/firectl/issues/comments{/number}","contents_url":"https://api.github.com/repos/firecracker-microvm/firectl/contents/{+path}","compare_url":"https://api.github.com/repos/firecracker-microvm/firectl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firecracker-microvm/firectl/merges","archive_url":"https://api.github.com/repos/firecracker-microvm/firectl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firecracker-microvm/firectl/downloads","issues_url":"https://api.github.com/repos/firecracker-microvm/firectl/issues{/number}","pulls_url":"https://api.github.com/repos/firecracker-microvm/firectl/pulls{/number}","milestones_url":"https://api.github.com/repos/firecracker-microvm/firectl/milestones{/number}","notifications_url":"https://api.github.com/repos/firecracker-microvm/firectl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firecracker-microvm/firectl/labels{/name}","releases_url":"https://api.github.com/repos/firecracker-microvm/firectl/releases{/id}","deployments_url":"https://api.github.com/repos/firecracker-microvm/firectl/deployments","created_at":"2018-12-04T23:39:49Z","updated_at":"2018-12-28T09:03:51Z","pushed_at":"2018-12-28T22:25:28Z","git_url":"git://github.com/firecracker-microvm/firectl.git","ssh_url":"git@github.com:firecracker-microvm/firectl.git","clone_url":"https://github.com/firecracker-microvm/firectl.git","svn_url":"https://github.com/firecracker-microvm/firectl","homepage":null,"size":26,"stargazers_count":11,"watchers_count":11,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":4,"open_issues":2,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/6"},"html":{"href":"https://github.com/firecracker-microvm/firectl/pull/6"},"issue":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/issues/6"},"comments":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/firecracker-microvm/firectl/statuses/3e81efa490b3b2dcbd909ca64ce1135269092feb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"xibz"}}