{"action":"created","comment":{"url":"https://api.github.com/repos/alpacahq/marketstore/pulls/comments/209692917","pull_request_review_id":145755623,"id":209692917,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTY5MjkxNw==","diff_hunk":"@@ -0,0 +1,100 @@\n+package connect\n+\n+import (\n+\t\"errors\"\n+\n+\t\"github.com/alpacahq/marketstore/cmd/connect/session\"\n+\t. \"github.com/alpacahq/marketstore/utils/log\"\n+\t\"github.com/spf13/cobra\"\n+)\n+\n+const (\n+\t// Command\n+\t// -------------\n+\tusage   = \"connect\"\n+\tshort   = \"Open an interactive session with an existing marketstore database\"\n+\tlong    = \"This command opens an interactive session with an existing marketstore database\"\n+\texample = \"marketstore connect --url <address>\"\n+\n+\t// Flags.\n+\t// -------------\n+\t// Network Address.\n+\turlFlag    = \"url\"\n+\tdefaultURL = \"\"\n+\turlDesc    = \"network address to database instance at \\\"hostname:port\\\" when used in remote mode\"\n+\t// Local directory.\n+\tdirFlag    = \"dir\"\n+\tdefaultDir = \"\"\n+\tdirDesc    = \"filesystem path of the directory containing database files when used in local mode\"\n+)\n+\n+var (\n+\t// Cmd is the connect command.\n+\tCmd = &cobra.Command{\n+\t\tUse:        usage,\n+\t\tShort:      short,\n+\t\tLong:       long,\n+\t\tSuggestFor: []string{\"mkts\", \"open\", \"conn\"},\n+\t\tExample:    example,\n+\t\tArgs:       validateArgs,\n+\t\tRunE:       executeConnect,\n+\t}\n+\n+\t// url set via flag for remote db address.\n+\turl string\n+\t// dir set via flag for local directory location.\n+\tdir string\n+)\n+\n+func init() {\n+\tCmd.Flags().StringVarP(&url, urlFlag, \"u\", defaultURL, urlDesc)\n+\tCmd.Flags().StringVarP(&dir, dirFlag, \"d\", defaultDir, dirDesc)\n+}\n+\n+// validateArgs returns an error that prevents cmd execution if\n+// the custom validation fails.\n+func validateArgs(cmd *cobra.Command, args []string) error {\n+\tif len(dir) == 0 && len(url) == 0 {\n+\t\treturn errors.New(\"cannot connect to database, use a flag to set location\")\n+\t}\n+\treturn nil\n+}\n+\n+// executeConnect implements the connect command.\n+func executeConnect(cmd *cobra.Command, args []string) error {\n+\n+\tvar c *session.Client\n+\tvar err error\n+\n+\t// Attempt local mode.\n+\tif len(dir) != 0 {\n+\t\tc, err = session.NewLocalClient(dir)\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t}\n+\n+\t// Attempt remote mode.\n+\tif len(url) != 0 {\n+\t\tc, err = session.NewRemoteClient(url)\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t}\n+\n+\t// Initialize connection.\n+\terr = c.Connect()\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\t//\tStart reader buffer.\n+\terr = c.Read()\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\t// TODO: Gracefully close connections and clean up.","path":"cmd/connect/main.go","position":97,"original_position":97,"commit_id":"1a1d77ff7c356393720840ce42c0f73978a8e7f2","original_commit_id":"1a1d77ff7c356393720840ce42c0f73978a8e7f2","user":{"login":"rocketbitz","id":18317032,"node_id":"MDQ6VXNlcjE4MzE3MDMy","avatar_url":"https://avatars1.githubusercontent.com/u/18317032?v=4","gravatar_id":"","url":"https://api.github.com/users/rocketbitz","html_url":"https://github.com/rocketbitz","followers_url":"https://api.github.com/users/rocketbitz/followers","following_url":"https://api.github.com/users/rocketbitz/following{/other_user}","gists_url":"https://api.github.com/users/rocketbitz/gists{/gist_id}","starred_url":"https://api.github.com/users/rocketbitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rocketbitz/subscriptions","organizations_url":"https://api.github.com/users/rocketbitz/orgs","repos_url":"https://api.github.com/users/rocketbitz/repos","events_url":"https://api.github.com/users/rocketbitz/events{/privacy}","received_events_url":"https://api.github.com/users/rocketbitz/received_events","type":"User","site_admin":false},"body":"this is important, no?","created_at":"2018-08-13T17:27:44Z","updated_at":"2018-08-13T17:27:44Z","html_url":"https://github.com/alpacahq/marketstore/pull/85#discussion_r209692917","pull_request_url":"https://api.github.com/repos/alpacahq/marketstore/pulls/85","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/alpacahq/marketstore/pulls/comments/209692917"},"html":{"href":"https://github.com/alpacahq/marketstore/pull/85#discussion_r209692917"},"pull_request":{"href":"https://api.github.com/repos/alpacahq/marketstore/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/alpacahq/marketstore/pulls/85","id":196346255,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2MzQ2MjU1","html_url":"https://github.com/alpacahq/marketstore/pull/85","diff_url":"https://github.com/alpacahq/marketstore/pull/85.diff","patch_url":"https://github.com/alpacahq/marketstore/pull/85.patch","issue_url":"https://api.github.com/repos/alpacahq/marketstore/issues/85","number":85,"state":"open","locked":false,"title":"Implements formal CLI framework","user":{"login":"ackleymi","id":3065126,"node_id":"MDQ6VXNlcjMwNjUxMjY=","avatar_url":"https://avatars3.githubusercontent.com/u/3065126?v=4","gravatar_id":"","url":"https://api.github.com/users/ackleymi","html_url":"https://github.com/ackleymi","followers_url":"https://api.github.com/users/ackleymi/followers","following_url":"https://api.github.com/users/ackleymi/following{/other_user}","gists_url":"https://api.github.com/users/ackleymi/gists{/gist_id}","starred_url":"https://api.github.com/users/ackleymi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ackleymi/subscriptions","organizations_url":"https://api.github.com/users/ackleymi/orgs","repos_url":"https://api.github.com/users/ackleymi/repos","events_url":"https://api.github.com/users/ackleymi/events{/privacy}","received_events_url":"https://api.github.com/users/ackleymi/received_events","type":"User","site_admin":false},"body":"Resolves https://github.com/alpacahq/marketstore/issues/62\r\n\r\nTo test, pull down and run a fresh install using `make install` then just run `marketstore` to list the subcommand options.","created_at":"2018-06-21T06:19:46Z","updated_at":"2018-08-13T17:27:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc8eda8202ddeb020cc072ad2abef7e7ab870e37","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alpacahq/marketstore/pulls/85/commits","review_comments_url":"https://api.github.com/repos/alpacahq/marketstore/pulls/85/comments","review_comment_url":"https://api.github.com/repos/alpacahq/marketstore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alpacahq/marketstore/issues/85/comments","statuses_url":"https://api.github.com/repos/alpacahq/marketstore/statuses/1a1d77ff7c356393720840ce42c0f73978a8e7f2","head":{"label":"ackleymi:master","ref":"master","sha":"1a1d77ff7c356393720840ce42c0f73978a8e7f2","user":{"login":"ackleymi","id":3065126,"node_id":"MDQ6VXNlcjMwNjUxMjY=","avatar_url":"https://avatars3.githubusercontent.com/u/3065126?v=4","gravatar_id":"","url":"https://api.github.com/users/ackleymi","html_url":"https://github.com/ackleymi","followers_url":"https://api.github.com/users/ackleymi/followers","following_url":"https://api.github.com/users/ackleymi/following{/other_user}","gists_url":"https://api.github.com/users/ackleymi/gists{/gist_id}","starred_url":"https://api.github.com/users/ackleymi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ackleymi/subscriptions","organizations_url":"https://api.github.com/users/ackleymi/orgs","repos_url":"https://api.github.com/users/ackleymi/repos","events_url":"https://api.github.com/users/ackleymi/events{/privacy}","received_events_url":"https://api.github.com/users/ackleymi/received_events","type":"User","site_admin":false},"repo":{"id":134643070,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ2NDMwNzA=","name":"marketstore","full_name":"ackleymi/marketstore","owner":{"login":"ackleymi","id":3065126,"node_id":"MDQ6VXNlcjMwNjUxMjY=","avatar_url":"https://avatars3.githubusercontent.com/u/3065126?v=4","gravatar_id":"","url":"https://api.github.com/users/ackleymi","html_url":"https://github.com/ackleymi","followers_url":"https://api.github.com/users/ackleymi/followers","following_url":"https://api.github.com/users/ackleymi/following{/other_user}","gists_url":"https://api.github.com/users/ackleymi/gists{/gist_id}","starred_url":"https://api.github.com/users/ackleymi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ackleymi/subscriptions","organizations_url":"https://api.github.com/users/ackleymi/orgs","repos_url":"https://api.github.com/users/ackleymi/repos","events_url":"https://api.github.com/users/ackleymi/events{/privacy}","received_events_url":"https://api.github.com/users/ackleymi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ackleymi/marketstore","description":"DataFrame Server for Financial Timeseries Data","fork":true,"url":"https://api.github.com/repos/ackleymi/marketstore","forks_url":"https://api.github.com/repos/ackleymi/marketstore/forks","keys_url":"https://api.github.com/repos/ackleymi/marketstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ackleymi/marketstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ackleymi/marketstore/teams","hooks_url":"https://api.github.com/repos/ackleymi/marketstore/hooks","issue_events_url":"https://api.github.com/repos/ackleymi/marketstore/issues/events{/number}","events_url":"https://api.github.com/repos/ackleymi/marketstore/events","assignees_url":"https://api.github.com/repos/ackleymi/marketstore/assignees{/user}","branches_url":"https://api.github.com/repos/ackleymi/marketstore/branches{/branch}","tags_url":"https://api.github.com/repos/ackleymi/marketstore/tags","blobs_url":"https://api.github.com/repos/ackleymi/marketstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ackleymi/marketstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ackleymi/marketstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ackleymi/marketstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ackleymi/marketstore/statuses/{sha}","languages_url":"https://api.github.com/repos/ackleymi/marketstore/languages","stargazers_url":"https://api.github.com/repos/ackleymi/marketstore/stargazers","contributors_url":"https://api.github.com/repos/ackleymi/marketstore/contributors","subscribers_url":"https://api.github.com/repos/ackleymi/marketstore/subscribers","subscription_url":"https://api.github.com/repos/ackleymi/marketstore/subscription","commits_url":"https://api.github.com/repos/ackleymi/marketstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ackleymi/marketstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ackleymi/marketstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ackleymi/marketstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ackleymi/marketstore/contents/{+path}","compare_url":"https://api.github.com/repos/ackleymi/marketstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ackleymi/marketstore/merges","archive_url":"https://api.github.com/repos/ackleymi/marketstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ackleymi/marketstore/downloads","issues_url":"https://api.github.com/repos/ackleymi/marketstore/issues{/number}","pulls_url":"https://api.github.com/repos/ackleymi/marketstore/pulls{/number}","milestones_url":"https://api.github.com/repos/ackleymi/marketstore/milestones{/number}","notifications_url":"https://api.github.com/repos/ackleymi/marketstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ackleymi/marketstore/labels{/name}","releases_url":"https://api.github.com/repos/ackleymi/marketstore/releases{/id}","deployments_url":"https://api.github.com/repos/ackleymi/marketstore/deployments","created_at":"2018-05-24T01:11:02Z","updated_at":"2018-08-13T02:05:25Z","pushed_at":"2018-08-13T02:05:23Z","git_url":"git://github.com/ackleymi/marketstore.git","ssh_url":"git@github.com:ackleymi/marketstore.git","clone_url":"https://github.com/ackleymi/marketstore.git","svn_url":"https://github.com/ackleymi/marketstore","homepage":"","size":686,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"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":"alpacahq:master","ref":"master","sha":"954843051f883f85ac2faa9dd5a70f1483bef64e","user":{"login":"alpacahq","id":30398729,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMzk4NzI5","avatar_url":"https://avatars1.githubusercontent.com/u/30398729?v=4","gravatar_id":"","url":"https://api.github.com/users/alpacahq","html_url":"https://github.com/alpacahq","followers_url":"https://api.github.com/users/alpacahq/followers","following_url":"https://api.github.com/users/alpacahq/following{/other_user}","gists_url":"https://api.github.com/users/alpacahq/gists{/gist_id}","starred_url":"https://api.github.com/users/alpacahq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpacahq/subscriptions","organizations_url":"https://api.github.com/users/alpacahq/orgs","repos_url":"https://api.github.com/users/alpacahq/repos","events_url":"https://api.github.com/users/alpacahq/events{/privacy}","received_events_url":"https://api.github.com/users/alpacahq/received_events","type":"Organization","site_admin":false},"repo":{"id":116546320,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY1NDYzMjA=","name":"marketstore","full_name":"alpacahq/marketstore","owner":{"login":"alpacahq","id":30398729,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMzk4NzI5","avatar_url":"https://avatars1.githubusercontent.com/u/30398729?v=4","gravatar_id":"","url":"https://api.github.com/users/alpacahq","html_url":"https://github.com/alpacahq","followers_url":"https://api.github.com/users/alpacahq/followers","following_url":"https://api.github.com/users/alpacahq/following{/other_user}","gists_url":"https://api.github.com/users/alpacahq/gists{/gist_id}","starred_url":"https://api.github.com/users/alpacahq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpacahq/subscriptions","organizations_url":"https://api.github.com/users/alpacahq/orgs","repos_url":"https://api.github.com/users/alpacahq/repos","events_url":"https://api.github.com/users/alpacahq/events{/privacy}","received_events_url":"https://api.github.com/users/alpacahq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alpacahq/marketstore","description":"DataFrame Server for Financial Timeseries Data","fork":false,"url":"https://api.github.com/repos/alpacahq/marketstore","forks_url":"https://api.github.com/repos/alpacahq/marketstore/forks","keys_url":"https://api.github.com/repos/alpacahq/marketstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alpacahq/marketstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alpacahq/marketstore/teams","hooks_url":"https://api.github.com/repos/alpacahq/marketstore/hooks","issue_events_url":"https://api.github.com/repos/alpacahq/marketstore/issues/events{/number}","events_url":"https://api.github.com/repos/alpacahq/marketstore/events","assignees_url":"https://api.github.com/repos/alpacahq/marketstore/assignees{/user}","branches_url":"https://api.github.com/repos/alpacahq/marketstore/branches{/branch}","tags_url":"https://api.github.com/repos/alpacahq/marketstore/tags","blobs_url":"https://api.github.com/repos/alpacahq/marketstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alpacahq/marketstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alpacahq/marketstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/alpacahq/marketstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alpacahq/marketstore/statuses/{sha}","languages_url":"https://api.github.com/repos/alpacahq/marketstore/languages","stargazers_url":"https://api.github.com/repos/alpacahq/marketstore/stargazers","contributors_url":"https://api.github.com/repos/alpacahq/marketstore/contributors","subscribers_url":"https://api.github.com/repos/alpacahq/marketstore/subscribers","subscription_url":"https://api.github.com/repos/alpacahq/marketstore/subscription","commits_url":"https://api.github.com/repos/alpacahq/marketstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/alpacahq/marketstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/alpacahq/marketstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/alpacahq/marketstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/alpacahq/marketstore/contents/{+path}","compare_url":"https://api.github.com/repos/alpacahq/marketstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alpacahq/marketstore/merges","archive_url":"https://api.github.com/repos/alpacahq/marketstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alpacahq/marketstore/downloads","issues_url":"https://api.github.com/repos/alpacahq/marketstore/issues{/number}","pulls_url":"https://api.github.com/repos/alpacahq/marketstore/pulls{/number}","milestones_url":"https://api.github.com/repos/alpacahq/marketstore/milestones{/number}","notifications_url":"https://api.github.com/repos/alpacahq/marketstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alpacahq/marketstore/labels{/name}","releases_url":"https://api.github.com/repos/alpacahq/marketstore/releases{/id}","deployments_url":"https://api.github.com/repos/alpacahq/marketstore/deployments","created_at":"2018-01-07T07:27:25Z","updated_at":"2018-08-12T03:22:21Z","pushed_at":"2018-08-13T02:05:24Z","git_url":"git://github.com/alpacahq/marketstore.git","ssh_url":"git@github.com:alpacahq/marketstore.git","clone_url":"https://github.com/alpacahq/marketstore.git","svn_url":"https://github.com/alpacahq/marketstore","homepage":"","size":652,"stargazers_count":504,"watchers_count":504,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":19,"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":41,"open_issues":19,"watchers":504,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alpacahq/marketstore/pulls/85"},"html":{"href":"https://github.com/alpacahq/marketstore/pull/85"},"issue":{"href":"https://api.github.com/repos/alpacahq/marketstore/issues/85"},"comments":{"href":"https://api.github.com/repos/alpacahq/marketstore/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/alpacahq/marketstore/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/alpacahq/marketstore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alpacahq/marketstore/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/alpacahq/marketstore/statuses/1a1d77ff7c356393720840ce42c0f73978a8e7f2"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rocketbitz"}}