{"action":"created","comment":{"url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments/45992162","id":45992162,"diff_hunk":"@@ -22,18 +22,41 @@ package main\n import (\n \t\"fmt\"\n \t\"os\"\n-\t\"text/tabwriter\"\n \n-\t\"github.com/ubuntu-core/snappy/client\"\n+\t\"github.com/ubuntu-core/snappy/logger\"\n+\n+\t\"github.com/jessevdk/go-flags\"\n )\n \n-func main() {\n-\tcli := client.New()\n+type options struct {\n+\t// No global options yet\n+}\n \n-\tw := tabwriter.NewWriter(os.Stdout, 0, 8, 1, ' ', 0)\n-\tfmt.Fprintln(w, \"What\\tError\\tResult\")\n-\tsysInfo, err := cli.SysInfo()\n-\tfmt.Fprintf(w, \"get system info\\t%v\\t%#v\\n\", err, sysInfo)\n+var optionsData options\n \n-\tw.Flush()\n+var parser = flags.NewParser(&optionsData, flags.HelpFlag|flags.PassDoubleDash)\n+\n+func init() {\n+\terr := logger.SimpleSetup()\n+\tif err != nil {\n+\t\tfmt.Fprintf(os.Stderr, \"WARNING: failed to activate logging: %s\\n\", err)\n+\t}\n+}\n+\n+func run() error {\n+\t_, err := parser.Parse()\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tif _, ok := err.(*flags.Error); !ok {\n+\t\tlogger.Debugf(\"cannot parse arguments: %v: %v\", os.Args, err)\n+\t}\n+\treturn nil\n+}\n+\n+func main() {","path":"cmd/snap/main.go","position":45,"original_position":45,"commit_id":"1646341cf60332cf3f9037b39e459b4972f6e811","original_commit_id":"1646341cf60332cf3f9037b39e459b4972f6e811","user":{"login":"niemeyer","id":378683,"avatar_url":"https://avatars.githubusercontent.com/u/378683?v=3","gravatar_id":"","url":"https://api.github.com/users/niemeyer","html_url":"https://github.com/niemeyer","followers_url":"https://api.github.com/users/niemeyer/followers","following_url":"https://api.github.com/users/niemeyer/following{/other_user}","gists_url":"https://api.github.com/users/niemeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/niemeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niemeyer/subscriptions","organizations_url":"https://api.github.com/users/niemeyer/orgs","repos_url":"https://api.github.com/users/niemeyer/repos","events_url":"https://api.github.com/users/niemeyer/events{/privacy}","received_events_url":"https://api.github.com/users/niemeyer/received_events","type":"User","site_admin":false},"body":"As a very trivial nitpick, would you mind to move this up, right after `init()`? This is a trivial stub that won't grow much at all because all the meat will be inside `run()`, so moving it up we can see init, main, and run in a single screen right next to each other. `run` will grow longer, though.","created_at":"2015-11-26T16:04:06Z","updated_at":"2015-11-26T16:04:06Z","html_url":"https://github.com/ubuntu-core/snappy/pull/172#discussion_r45992162","pull_request_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/172","_links":{"self":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments/45992162"},"html":{"href":"https://github.com/ubuntu-core/snappy/pull/172#discussion_r45992162"},"pull_request":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/172"}}},"pull_request":{"url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/172","id":51824456,"html_url":"https://github.com/ubuntu-core/snappy/pull/172","diff_url":"https://github.com/ubuntu-core/snappy/pull/172.diff","patch_url":"https://github.com/ubuntu-core/snappy/pull/172.patch","issue_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/172","number":172,"state":"open","locked":false,"title":"End-to-end API for listing capabilities ","user":{"login":"zyga","id":784262,"avatar_url":"https://avatars.githubusercontent.com/u/784262?v=3","gravatar_id":"","url":"https://api.github.com/users/zyga","html_url":"https://github.com/zyga","followers_url":"https://api.github.com/users/zyga/followers","following_url":"https://api.github.com/users/zyga/following{/other_user}","gists_url":"https://api.github.com/users/zyga/gists{/gist_id}","starred_url":"https://api.github.com/users/zyga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zyga/subscriptions","organizations_url":"https://api.github.com/users/zyga/orgs","repos_url":"https://api.github.com/users/zyga/repos","events_url":"https://api.github.com/users/zyga/events{/privacy}","received_events_url":"https://api.github.com/users/zyga/received_events","type":"User","site_admin":false},"body":"This branch adds (as neat separate patches), end-to-end (from internal go API, though documented REST API, to go client API to a command line tool) method for listing snappy capabilities.","created_at":"2015-11-25T17:32:33Z","updated_at":"2015-11-26T16:04:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8338d730f7c0dd48b62f110deef561b291723f14","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/172/commits","review_comments_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/172/comments","review_comment_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/172/comments","statuses_url":"https://api.github.com/repos/ubuntu-core/snappy/statuses/1646341cf60332cf3f9037b39e459b4972f6e811","head":{"label":"zyga:caps-api-get-capabilities","ref":"caps-api-get-capabilities","sha":"1646341cf60332cf3f9037b39e459b4972f6e811","user":{"login":"zyga","id":784262,"avatar_url":"https://avatars.githubusercontent.com/u/784262?v=3","gravatar_id":"","url":"https://api.github.com/users/zyga","html_url":"https://github.com/zyga","followers_url":"https://api.github.com/users/zyga/followers","following_url":"https://api.github.com/users/zyga/following{/other_user}","gists_url":"https://api.github.com/users/zyga/gists{/gist_id}","starred_url":"https://api.github.com/users/zyga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zyga/subscriptions","organizations_url":"https://api.github.com/users/zyga/orgs","repos_url":"https://api.github.com/users/zyga/repos","events_url":"https://api.github.com/users/zyga/events{/privacy}","received_events_url":"https://api.github.com/users/zyga/received_events","type":"User","site_admin":false},"repo":{"id":45263078,"name":"snappy","full_name":"zyga/snappy","owner":{"login":"zyga","id":784262,"avatar_url":"https://avatars.githubusercontent.com/u/784262?v=3","gravatar_id":"","url":"https://api.github.com/users/zyga","html_url":"https://github.com/zyga","followers_url":"https://api.github.com/users/zyga/followers","following_url":"https://api.github.com/users/zyga/following{/other_user}","gists_url":"https://api.github.com/users/zyga/gists{/gist_id}","starred_url":"https://api.github.com/users/zyga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zyga/subscriptions","organizations_url":"https://api.github.com/users/zyga/orgs","repos_url":"https://api.github.com/users/zyga/repos","events_url":"https://api.github.com/users/zyga/events{/privacy}","received_events_url":"https://api.github.com/users/zyga/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zyga/snappy","description":"Snappy is the software at the heart of Ubuntu Core.","fork":true,"url":"https://api.github.com/repos/zyga/snappy","forks_url":"https://api.github.com/repos/zyga/snappy/forks","keys_url":"https://api.github.com/repos/zyga/snappy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zyga/snappy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zyga/snappy/teams","hooks_url":"https://api.github.com/repos/zyga/snappy/hooks","issue_events_url":"https://api.github.com/repos/zyga/snappy/issues/events{/number}","events_url":"https://api.github.com/repos/zyga/snappy/events","assignees_url":"https://api.github.com/repos/zyga/snappy/assignees{/user}","branches_url":"https://api.github.com/repos/zyga/snappy/branches{/branch}","tags_url":"https://api.github.com/repos/zyga/snappy/tags","blobs_url":"https://api.github.com/repos/zyga/snappy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zyga/snappy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zyga/snappy/git/refs{/sha}","trees_url":"https://api.github.com/repos/zyga/snappy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zyga/snappy/statuses/{sha}","languages_url":"https://api.github.com/repos/zyga/snappy/languages","stargazers_url":"https://api.github.com/repos/zyga/snappy/stargazers","contributors_url":"https://api.github.com/repos/zyga/snappy/contributors","subscribers_url":"https://api.github.com/repos/zyga/snappy/subscribers","subscription_url":"https://api.github.com/repos/zyga/snappy/subscription","commits_url":"https://api.github.com/repos/zyga/snappy/commits{/sha}","git_commits_url":"https://api.github.com/repos/zyga/snappy/git/commits{/sha}","comments_url":"https://api.github.com/repos/zyga/snappy/comments{/number}","issue_comment_url":"https://api.github.com/repos/zyga/snappy/issues/comments{/number}","contents_url":"https://api.github.com/repos/zyga/snappy/contents/{+path}","compare_url":"https://api.github.com/repos/zyga/snappy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zyga/snappy/merges","archive_url":"https://api.github.com/repos/zyga/snappy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zyga/snappy/downloads","issues_url":"https://api.github.com/repos/zyga/snappy/issues{/number}","pulls_url":"https://api.github.com/repos/zyga/snappy/pulls{/number}","milestones_url":"https://api.github.com/repos/zyga/snappy/milestones{/number}","notifications_url":"https://api.github.com/repos/zyga/snappy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zyga/snappy/labels{/name}","releases_url":"https://api.github.com/repos/zyga/snappy/releases{/id}","created_at":"2015-10-30T16:30:25Z","updated_at":"2015-10-30T16:30:28Z","pushed_at":"2015-11-26T12:02:39Z","git_url":"git://github.com/zyga/snappy.git","ssh_url":"git@github.com:zyga/snappy.git","clone_url":"https://github.com/zyga/snappy.git","svn_url":"https://github.com/zyga/snappy","homepage":null,"size":23401,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"15.04"}},"base":{"label":"ubuntu-core:master","ref":"master","sha":"cf10c2f94a2bcdf07a78cf5934d72c880e20f127","user":{"login":"ubuntu-core","id":15022473,"avatar_url":"https://avatars.githubusercontent.com/u/15022473?v=3","gravatar_id":"","url":"https://api.github.com/users/ubuntu-core","html_url":"https://github.com/ubuntu-core","followers_url":"https://api.github.com/users/ubuntu-core/followers","following_url":"https://api.github.com/users/ubuntu-core/following{/other_user}","gists_url":"https://api.github.com/users/ubuntu-core/gists{/gist_id}","starred_url":"https://api.github.com/users/ubuntu-core/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubuntu-core/subscriptions","organizations_url":"https://api.github.com/users/ubuntu-core/orgs","repos_url":"https://api.github.com/users/ubuntu-core/repos","events_url":"https://api.github.com/users/ubuntu-core/events{/privacy}","received_events_url":"https://api.github.com/users/ubuntu-core/received_events","type":"Organization","site_admin":false},"repo":{"id":44672744,"name":"snappy","full_name":"ubuntu-core/snappy","owner":{"login":"ubuntu-core","id":15022473,"avatar_url":"https://avatars.githubusercontent.com/u/15022473?v=3","gravatar_id":"","url":"https://api.github.com/users/ubuntu-core","html_url":"https://github.com/ubuntu-core","followers_url":"https://api.github.com/users/ubuntu-core/followers","following_url":"https://api.github.com/users/ubuntu-core/following{/other_user}","gists_url":"https://api.github.com/users/ubuntu-core/gists{/gist_id}","starred_url":"https://api.github.com/users/ubuntu-core/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubuntu-core/subscriptions","organizations_url":"https://api.github.com/users/ubuntu-core/orgs","repos_url":"https://api.github.com/users/ubuntu-core/repos","events_url":"https://api.github.com/users/ubuntu-core/events{/privacy}","received_events_url":"https://api.github.com/users/ubuntu-core/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ubuntu-core/snappy","description":"Snappy is the software at the heart of Ubuntu Core.","fork":false,"url":"https://api.github.com/repos/ubuntu-core/snappy","forks_url":"https://api.github.com/repos/ubuntu-core/snappy/forks","keys_url":"https://api.github.com/repos/ubuntu-core/snappy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ubuntu-core/snappy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ubuntu-core/snappy/teams","hooks_url":"https://api.github.com/repos/ubuntu-core/snappy/hooks","issue_events_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/events{/number}","events_url":"https://api.github.com/repos/ubuntu-core/snappy/events","assignees_url":"https://api.github.com/repos/ubuntu-core/snappy/assignees{/user}","branches_url":"https://api.github.com/repos/ubuntu-core/snappy/branches{/branch}","tags_url":"https://api.github.com/repos/ubuntu-core/snappy/tags","blobs_url":"https://api.github.com/repos/ubuntu-core/snappy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ubuntu-core/snappy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ubuntu-core/snappy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ubuntu-core/snappy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ubuntu-core/snappy/statuses/{sha}","languages_url":"https://api.github.com/repos/ubuntu-core/snappy/languages","stargazers_url":"https://api.github.com/repos/ubuntu-core/snappy/stargazers","contributors_url":"https://api.github.com/repos/ubuntu-core/snappy/contributors","subscribers_url":"https://api.github.com/repos/ubuntu-core/snappy/subscribers","subscription_url":"https://api.github.com/repos/ubuntu-core/snappy/subscription","commits_url":"https://api.github.com/repos/ubuntu-core/snappy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ubuntu-core/snappy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ubuntu-core/snappy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ubuntu-core/snappy/contents/{+path}","compare_url":"https://api.github.com/repos/ubuntu-core/snappy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ubuntu-core/snappy/merges","archive_url":"https://api.github.com/repos/ubuntu-core/snappy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ubuntu-core/snappy/downloads","issues_url":"https://api.github.com/repos/ubuntu-core/snappy/issues{/number}","pulls_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls{/number}","milestones_url":"https://api.github.com/repos/ubuntu-core/snappy/milestones{/number}","notifications_url":"https://api.github.com/repos/ubuntu-core/snappy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ubuntu-core/snappy/labels{/name}","releases_url":"https://api.github.com/repos/ubuntu-core/snappy/releases{/id}","created_at":"2015-10-21T11:51:46Z","updated_at":"2015-11-25T15:23:13Z","pushed_at":"2015-11-26T15:48:59Z","git_url":"git://github.com/ubuntu-core/snappy.git","ssh_url":"git@github.com:ubuntu-core/snappy.git","clone_url":"https://github.com/ubuntu-core/snappy.git","svn_url":"https://github.com/ubuntu-core/snappy","homepage":null,"size":24057,"stargazers_count":37,"watchers_count":37,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":15,"forks":16,"open_issues":15,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/172"},"html":{"href":"https://github.com/ubuntu-core/snappy/pull/172"},"issue":{"href":"https://api.github.com/repos/ubuntu-core/snappy/issues/172"},"comments":{"href":"https://api.github.com/repos/ubuntu-core/snappy/issues/172/comments"},"review_comments":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/172/comments"},"review_comment":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/172/commits"},"statuses":{"href":"https://api.github.com/repos/ubuntu-core/snappy/statuses/1646341cf60332cf3f9037b39e459b4972f6e811"}}}}