{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/40349536","id":40349536,"diff_hunk":"@@ -274,12 +275,48 @@ func (b *Builder) SelectAllParam(selectAll bool) *Builder {\n \treturn b\n }\n \n+func hasNamesArg(args []string) bool {\n+\tif len(args) > 1 {\n+\t\treturn true\n+\t}\n+\tnewArgs := []string{}\n+\tfor _, s := range args {\n+\t\tnewArgs = append(newArgs, strings.Split(s, \",\")...)\n+\t}\n+\targs = newArgs\n+\tfor _, s := range args {\n+\t\tif !strings.Contains(s, \"/\") {\n+\t\t\treturn false\n+\t\t}\n+\t\ttuple := strings.Split(s, \"/\")\n+\t\tif len(tuple) != 3 && isGroup(tuple[0]) {\n+\t\t\treturn false\n+\t\t}\n+\t}\n+\treturn true\n+}\n+\n+func getResource(groupResource string) string {\n+\tif strings.Contains(groupResource, \"/\") {\n+\t\treturn strings.Split(groupResource, \"/\")[1]\n+\t}\n+\treturn groupResource\n+}\n+\n+func isGroup(group string) bool {\n+\t_, err := latest.Group(group)\n+\treturn err == nil\n+}\n+\n // ResourceTypeOrNameArgs indicates that the builder should accept arguments\n // of the form `(<type1>[,<type2>,...]|<type> <name1>[,<name2>,...])`. When one argument is","path":"pkg/kubectl/resource/builder.go","position":null,"original_position":46,"commit_id":"f511fc17dcb4f2b709eaef712f96eb2c514210e3","original_commit_id":"315a909325a4a8f0d5e8cdf00778964032e6a693","user":{"login":"JanetKuo","id":4876867,"avatar_url":"https://avatars.githubusercontent.com/u/4876867?v=3","gravatar_id":"","url":"https://api.github.com/users/JanetKuo","html_url":"https://github.com/JanetKuo","followers_url":"https://api.github.com/users/JanetKuo/followers","following_url":"https://api.github.com/users/JanetKuo/following{/other_user}","gists_url":"https://api.github.com/users/JanetKuo/gists{/gist_id}","starred_url":"https://api.github.com/users/JanetKuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanetKuo/subscriptions","organizations_url":"https://api.github.com/users/JanetKuo/orgs","repos_url":"https://api.github.com/users/JanetKuo/repos","events_url":"https://api.github.com/users/JanetKuo/events{/privacy}","received_events_url":"https://api.github.com/users/JanetKuo/received_events","type":"User","site_admin":false},"body":"Fixed","created_at":"2015-09-24T17:53:23Z","updated_at":"2015-09-24T17:53:23Z","html_url":"https://github.com/kubernetes/kubernetes/pull/14461#discussion_r40349536","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/14461","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/40349536"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/14461#discussion_r40349536"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/14461"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/14461","id":45850476,"html_url":"https://github.com/kubernetes/kubernetes/pull/14461","diff_url":"https://github.com/kubernetes/kubernetes/pull/14461.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/14461.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/14461","number":14461,"state":"open","locked":false,"title":"RFC: Support kubectl group/resource name","user":{"login":"JanetKuo","id":4876867,"avatar_url":"https://avatars.githubusercontent.com/u/4876867?v=3","gravatar_id":"","url":"https://api.github.com/users/JanetKuo","html_url":"https://github.com/JanetKuo","followers_url":"https://api.github.com/users/JanetKuo/followers","following_url":"https://api.github.com/users/JanetKuo/following{/other_user}","gists_url":"https://api.github.com/users/JanetKuo/gists{/gist_id}","starred_url":"https://api.github.com/users/JanetKuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanetKuo/subscriptions","organizations_url":"https://api.github.com/users/JanetKuo/orgs","repos_url":"https://api.github.com/users/JanetKuo/repos","events_url":"https://api.github.com/users/JanetKuo/events{/privacy}","received_events_url":"https://api.github.com/users/JanetKuo/received_events","type":"User","site_admin":false},"body":"Partially fixes - #13929\r\n\r\nAllow users to do things like `kubectl get group/resource name`, `kubectl get group/resource`. The format of resource variable is either \"resource\" or \"group/resource\". \r\n\r\ncc @lavalamp @caesarxuchao ","created_at":"2015-09-24T01:24:00Z","updated_at":"2015-09-24T17:53:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a50745b136858399539949d480875f9ee75fc1d2","assignee":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","gravatar_id":"","url":"https://api.github.com/users/smarterclayton","html_url":"https://github.com/smarterclayton","followers_url":"https://api.github.com/users/smarterclayton/followers","following_url":"https://api.github.com/users/smarterclayton/following{/other_user}","gists_url":"https://api.github.com/users/smarterclayton/gists{/gist_id}","starred_url":"https://api.github.com/users/smarterclayton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarterclayton/subscriptions","organizations_url":"https://api.github.com/users/smarterclayton/orgs","repos_url":"https://api.github.com/users/smarterclayton/repos","events_url":"https://api.github.com/users/smarterclayton/events{/privacy}","received_events_url":"https://api.github.com/users/smarterclayton/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/14461/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/14461/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/14461/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/f511fc17dcb4f2b709eaef712f96eb2c514210e3","head":{"label":"JanetKuo:kubectl-api-group-cmd","ref":"kubectl-api-group-cmd","sha":"f511fc17dcb4f2b709eaef712f96eb2c514210e3","user":{"login":"JanetKuo","id":4876867,"avatar_url":"https://avatars.githubusercontent.com/u/4876867?v=3","gravatar_id":"","url":"https://api.github.com/users/JanetKuo","html_url":"https://github.com/JanetKuo","followers_url":"https://api.github.com/users/JanetKuo/followers","following_url":"https://api.github.com/users/JanetKuo/following{/other_user}","gists_url":"https://api.github.com/users/JanetKuo/gists{/gist_id}","starred_url":"https://api.github.com/users/JanetKuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanetKuo/subscriptions","organizations_url":"https://api.github.com/users/JanetKuo/orgs","repos_url":"https://api.github.com/users/JanetKuo/repos","events_url":"https://api.github.com/users/JanetKuo/events{/privacy}","received_events_url":"https://api.github.com/users/JanetKuo/received_events","type":"User","site_admin":false},"repo":{"id":37748937,"name":"kubernetes","full_name":"JanetKuo/kubernetes","owner":{"login":"JanetKuo","id":4876867,"avatar_url":"https://avatars.githubusercontent.com/u/4876867?v=3","gravatar_id":"","url":"https://api.github.com/users/JanetKuo","html_url":"https://github.com/JanetKuo","followers_url":"https://api.github.com/users/JanetKuo/followers","following_url":"https://api.github.com/users/JanetKuo/following{/other_user}","gists_url":"https://api.github.com/users/JanetKuo/gists{/gist_id}","starred_url":"https://api.github.com/users/JanetKuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanetKuo/subscriptions","organizations_url":"https://api.github.com/users/JanetKuo/orgs","repos_url":"https://api.github.com/users/JanetKuo/repos","events_url":"https://api.github.com/users/JanetKuo/events{/privacy}","received_events_url":"https://api.github.com/users/JanetKuo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JanetKuo/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/JanetKuo/kubernetes","forks_url":"https://api.github.com/repos/JanetKuo/kubernetes/forks","keys_url":"https://api.github.com/repos/JanetKuo/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JanetKuo/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JanetKuo/kubernetes/teams","hooks_url":"https://api.github.com/repos/JanetKuo/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/JanetKuo/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/JanetKuo/kubernetes/events","assignees_url":"https://api.github.com/repos/JanetKuo/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/JanetKuo/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/JanetKuo/kubernetes/tags","blobs_url":"https://api.github.com/repos/JanetKuo/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JanetKuo/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JanetKuo/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/JanetKuo/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JanetKuo/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/JanetKuo/kubernetes/languages","stargazers_url":"https://api.github.com/repos/JanetKuo/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/JanetKuo/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/JanetKuo/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/JanetKuo/kubernetes/subscription","commits_url":"https://api.github.com/repos/JanetKuo/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/JanetKuo/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/JanetKuo/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/JanetKuo/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/JanetKuo/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/JanetKuo/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JanetKuo/kubernetes/merges","archive_url":"https://api.github.com/repos/JanetKuo/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JanetKuo/kubernetes/downloads","issues_url":"https://api.github.com/repos/JanetKuo/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/JanetKuo/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/JanetKuo/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/JanetKuo/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JanetKuo/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/JanetKuo/kubernetes/releases{/id}","created_at":"2015-06-19T22:29:18Z","updated_at":"2015-06-19T22:29:25Z","pushed_at":"2015-09-24T17:53:01Z","git_url":"git://github.com/JanetKuo/kubernetes.git","ssh_url":"git@github.com:JanetKuo/kubernetes.git","clone_url":"https://github.com/JanetKuo/kubernetes.git","svn_url":"https://github.com/JanetKuo/kubernetes","homepage":"http://kubernetes.io","size":110536,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"0662141f67435927bc14f3694d77edce2c25431e","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-09-24T17:05:20Z","pushed_at":"2015-09-24T17:53:01Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":428930,"stargazers_count":10416,"watchers_count":10416,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2590,"mirror_url":null,"open_issues_count":1898,"forks":2590,"open_issues":1898,"watchers":10416,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/14461"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/14461"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/14461"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/14461/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/14461/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/14461/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/f511fc17dcb4f2b709eaef712f96eb2c514210e3"}}}}