{"action":"created","comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/pulls/comments/111732314","pull_request_review_id":32993121,"id":111732314,"diff_hunk":"@@ -15,60 +15,193 @@ function __fish_terraform_needs_command\n     return 0\n end\n \n+function __fish_terraform_using_command\n+    set cmd (commandline -opc)\n+    if [ (count $cmd) -eq 1 ]\n+        return 0\n+    end\n+\n+    for arg in $cmd[2..-1]\n+        switch $arg\n+            case '--*'\n+                # ignore global flags\n+            case $argv[1]\n+                return 0\n+            case '*'\n+                return 1\n+        end\n+    end\n+    return 1\n+end\n+\n # general options\n-complete -f -c terraform -n '__fish_terraform_needs_command' -l version -d 'Print version information'\n-complete -f -c terraform -n '__fish_terraform_needs_command' -l help -d 'Show help'\n+complete -f -c terraform -l version -d 'Print version information'\n+complete -f -c terraform -l help -d 'Show help'\n \n ### apply\n complete -f -c terraform -n '__fish_terraform_needs_command' -a apply -d 'Builds or changes infrastructure'\n+complete -f -c terraform -n '__fish_terraform_using_command apply' -o backup -d 'Path to backup the existing state file'","path":"share/completions/terraform.fish","position":null,"original_position":31,"commit_id":"d813667fd8ae7141a66451774d5e94b6b1d0f211","original_commit_id":"fd817b503d1337a571f918f4c2b44a6aedc3074c","user":{"login":"adambyrtek","id":8214,"avatar_url":"https://avatars3.githubusercontent.com/u/8214?v=3","gravatar_id":"","url":"https://api.github.com/users/adambyrtek","html_url":"https://github.com/adambyrtek","followers_url":"https://api.github.com/users/adambyrtek/followers","following_url":"https://api.github.com/users/adambyrtek/following{/other_user}","gists_url":"https://api.github.com/users/adambyrtek/gists{/gist_id}","starred_url":"https://api.github.com/users/adambyrtek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambyrtek/subscriptions","organizations_url":"https://api.github.com/users/adambyrtek/orgs","repos_url":"https://api.github.com/users/adambyrtek/repos","events_url":"https://api.github.com/users/adambyrtek/events{/privacy}","received_events_url":"https://api.github.com/users/adambyrtek/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2017-04-17T11:29:11Z","updated_at":"2017-04-17T11:29:11Z","html_url":"https://github.com/fish-shell/fish-shell/pull/3960#discussion_r111732314","pull_request_url":"https://api.github.com/repos/fish-shell/fish-shell/pulls/3960","_links":{"self":{"href":"https://api.github.com/repos/fish-shell/fish-shell/pulls/comments/111732314"},"html":{"href":"https://github.com/fish-shell/fish-shell/pull/3960#discussion_r111732314"},"pull_request":{"href":"https://api.github.com/repos/fish-shell/fish-shell/pulls/3960"}}},"pull_request":{"url":"https://api.github.com/repos/fish-shell/fish-shell/pulls/3960","id":116075190,"html_url":"https://github.com/fish-shell/fish-shell/pull/3960","diff_url":"https://github.com/fish-shell/fish-shell/pull/3960.diff","patch_url":"https://github.com/fish-shell/fish-shell/pull/3960.patch","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3960","number":3960,"state":"open","locked":false,"title":"Terraform command completions","user":{"login":"adambyrtek","id":8214,"avatar_url":"https://avatars3.githubusercontent.com/u/8214?v=3","gravatar_id":"","url":"https://api.github.com/users/adambyrtek","html_url":"https://github.com/adambyrtek","followers_url":"https://api.github.com/users/adambyrtek/followers","following_url":"https://api.github.com/users/adambyrtek/following{/other_user}","gists_url":"https://api.github.com/users/adambyrtek/gists{/gist_id}","starred_url":"https://api.github.com/users/adambyrtek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambyrtek/subscriptions","organizations_url":"https://api.github.com/users/adambyrtek/orgs","repos_url":"https://api.github.com/users/adambyrtek/repos","events_url":"https://api.github.com/users/adambyrtek/events{/privacy}","received_events_url":"https://api.github.com/users/adambyrtek/received_events","type":"User","site_admin":false},"body":"## Description\r\n\r\nTerraform is an open source declarative infrastructure management tool:\r\nhttps://www.terraform.io\r\nhttps://github.com/hashicorp/terraform\r\n\r\nThis PR adds completions for all basic commands and their flags:\r\n\r\n```\r\n$ terraform help\r\nUsage: terraform [--version] [--help] <command> [args]\r\n\r\nThe available commands for execution are listed below.\r\nThe most common, useful commands are shown first, followed by\r\nless common or more advanced commands. If you're just getting\r\nstarted with Terraform, stick with the common commands. For the\r\nother commands, please read the help and docs before usage.\r\n\r\nCommon commands:\r\n    apply              Builds or changes infrastructure\r\n    console            Interactive console for Terraform interpolations\r\n    destroy            Destroy Terraform-managed infrastructure\r\n    env                Environment management\r\n    fmt                Rewrites config files to canonical format\r\n    get                Download and install modules for the configuration\r\n    graph              Create a visual graph of Terraform resources\r\n    import             Import existing infrastructure into Terraform\r\n    init               Initialize a new or existing Terraform configuration\r\n    output             Read an output from a state file\r\n    plan               Generate and show an execution plan\r\n    push               Upload this Terraform module to Atlas to run\r\n    refresh            Update local state file against real resources\r\n    show               Inspect Terraform state or plan\r\n    taint              Manually mark a resource for recreation\r\n    untaint            Manually unmark a resource as tainted\r\n    validate           Validates the Terraform files\r\n    version            Prints the Terraform version\r\n```\r\n\r\nThe code was based on Git completions in order to keep things consistent.\r\n\r\n## TODOs:\r\n<!-- Just check off what what we know been done so far. We can help you with this stuff. -->\r\n- [ ] Changes to fish usage are reflected in user documentation/manpages (N/A)\r\n- [ ] Tests have been added for regressions fixed (N/A)\r\n- [x] User-visible changes noted in CHANGELOG.md\r\n","created_at":"2017-04-16T23:28:10Z","updated_at":"2017-04-17T11:29:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c900593e15a79e4820a21d7d4e0cba3b0f2638a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/fish-shell/fish-shell/pulls/3960/commits","review_comments_url":"https://api.github.com/repos/fish-shell/fish-shell/pulls/3960/comments","review_comment_url":"https://api.github.com/repos/fish-shell/fish-shell/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3960/comments","statuses_url":"https://api.github.com/repos/fish-shell/fish-shell/statuses/d813667fd8ae7141a66451774d5e94b6b1d0f211","head":{"label":"adambyrtek:terraform-completion","ref":"terraform-completion","sha":"d813667fd8ae7141a66451774d5e94b6b1d0f211","user":{"login":"adambyrtek","id":8214,"avatar_url":"https://avatars3.githubusercontent.com/u/8214?v=3","gravatar_id":"","url":"https://api.github.com/users/adambyrtek","html_url":"https://github.com/adambyrtek","followers_url":"https://api.github.com/users/adambyrtek/followers","following_url":"https://api.github.com/users/adambyrtek/following{/other_user}","gists_url":"https://api.github.com/users/adambyrtek/gists{/gist_id}","starred_url":"https://api.github.com/users/adambyrtek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambyrtek/subscriptions","organizations_url":"https://api.github.com/users/adambyrtek/orgs","repos_url":"https://api.github.com/users/adambyrtek/repos","events_url":"https://api.github.com/users/adambyrtek/events{/privacy}","received_events_url":"https://api.github.com/users/adambyrtek/received_events","type":"User","site_admin":false},"repo":{"id":88444152,"name":"fish-shell","full_name":"adambyrtek/fish-shell","owner":{"login":"adambyrtek","id":8214,"avatar_url":"https://avatars3.githubusercontent.com/u/8214?v=3","gravatar_id":"","url":"https://api.github.com/users/adambyrtek","html_url":"https://github.com/adambyrtek","followers_url":"https://api.github.com/users/adambyrtek/followers","following_url":"https://api.github.com/users/adambyrtek/following{/other_user}","gists_url":"https://api.github.com/users/adambyrtek/gists{/gist_id}","starred_url":"https://api.github.com/users/adambyrtek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambyrtek/subscriptions","organizations_url":"https://api.github.com/users/adambyrtek/orgs","repos_url":"https://api.github.com/users/adambyrtek/repos","events_url":"https://api.github.com/users/adambyrtek/events{/privacy}","received_events_url":"https://api.github.com/users/adambyrtek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adambyrtek/fish-shell","description":"The user-friendly command line shell.","fork":true,"url":"https://api.github.com/repos/adambyrtek/fish-shell","forks_url":"https://api.github.com/repos/adambyrtek/fish-shell/forks","keys_url":"https://api.github.com/repos/adambyrtek/fish-shell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adambyrtek/fish-shell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adambyrtek/fish-shell/teams","hooks_url":"https://api.github.com/repos/adambyrtek/fish-shell/hooks","issue_events_url":"https://api.github.com/repos/adambyrtek/fish-shell/issues/events{/number}","events_url":"https://api.github.com/repos/adambyrtek/fish-shell/events","assignees_url":"https://api.github.com/repos/adambyrtek/fish-shell/assignees{/user}","branches_url":"https://api.github.com/repos/adambyrtek/fish-shell/branches{/branch}","tags_url":"https://api.github.com/repos/adambyrtek/fish-shell/tags","blobs_url":"https://api.github.com/repos/adambyrtek/fish-shell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adambyrtek/fish-shell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adambyrtek/fish-shell/git/refs{/sha}","trees_url":"https://api.github.com/repos/adambyrtek/fish-shell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adambyrtek/fish-shell/statuses/{sha}","languages_url":"https://api.github.com/repos/adambyrtek/fish-shell/languages","stargazers_url":"https://api.github.com/repos/adambyrtek/fish-shell/stargazers","contributors_url":"https://api.github.com/repos/adambyrtek/fish-shell/contributors","subscribers_url":"https://api.github.com/repos/adambyrtek/fish-shell/subscribers","subscription_url":"https://api.github.com/repos/adambyrtek/fish-shell/subscription","commits_url":"https://api.github.com/repos/adambyrtek/fish-shell/commits{/sha}","git_commits_url":"https://api.github.com/repos/adambyrtek/fish-shell/git/commits{/sha}","comments_url":"https://api.github.com/repos/adambyrtek/fish-shell/comments{/number}","issue_comment_url":"https://api.github.com/repos/adambyrtek/fish-shell/issues/comments{/number}","contents_url":"https://api.github.com/repos/adambyrtek/fish-shell/contents/{+path}","compare_url":"https://api.github.com/repos/adambyrtek/fish-shell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adambyrtek/fish-shell/merges","archive_url":"https://api.github.com/repos/adambyrtek/fish-shell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adambyrtek/fish-shell/downloads","issues_url":"https://api.github.com/repos/adambyrtek/fish-shell/issues{/number}","pulls_url":"https://api.github.com/repos/adambyrtek/fish-shell/pulls{/number}","milestones_url":"https://api.github.com/repos/adambyrtek/fish-shell/milestones{/number}","notifications_url":"https://api.github.com/repos/adambyrtek/fish-shell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adambyrtek/fish-shell/labels{/name}","releases_url":"https://api.github.com/repos/adambyrtek/fish-shell/releases{/id}","deployments_url":"https://api.github.com/repos/adambyrtek/fish-shell/deployments","created_at":"2017-04-16T21:39:52Z","updated_at":"2017-04-16T21:39:56Z","pushed_at":"2017-04-17T11:28:49Z","git_url":"git://github.com/adambyrtek/fish-shell.git","ssh_url":"git@github.com:adambyrtek/fish-shell.git","clone_url":"https://github.com/adambyrtek/fish-shell.git","svn_url":"https://github.com/adambyrtek/fish-shell","homepage":"http://fishshell.com","size":35592,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_projects":true,"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":"master"}},"base":{"label":"fish-shell:master","ref":"master","sha":"e332573fe1b75c45c3cfeb1fbea951a6e8d33d1d","user":{"login":"fish-shell","id":1828073,"avatar_url":"https://avatars3.githubusercontent.com/u/1828073?v=3","gravatar_id":"","url":"https://api.github.com/users/fish-shell","html_url":"https://github.com/fish-shell","followers_url":"https://api.github.com/users/fish-shell/followers","following_url":"https://api.github.com/users/fish-shell/following{/other_user}","gists_url":"https://api.github.com/users/fish-shell/gists{/gist_id}","starred_url":"https://api.github.com/users/fish-shell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fish-shell/subscriptions","organizations_url":"https://api.github.com/users/fish-shell/orgs","repos_url":"https://api.github.com/users/fish-shell/repos","events_url":"https://api.github.com/users/fish-shell/events{/privacy}","received_events_url":"https://api.github.com/users/fish-shell/received_events","type":"Organization","site_admin":false},"repo":{"id":4279682,"name":"fish-shell","full_name":"fish-shell/fish-shell","owner":{"login":"fish-shell","id":1828073,"avatar_url":"https://avatars3.githubusercontent.com/u/1828073?v=3","gravatar_id":"","url":"https://api.github.com/users/fish-shell","html_url":"https://github.com/fish-shell","followers_url":"https://api.github.com/users/fish-shell/followers","following_url":"https://api.github.com/users/fish-shell/following{/other_user}","gists_url":"https://api.github.com/users/fish-shell/gists{/gist_id}","starred_url":"https://api.github.com/users/fish-shell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fish-shell/subscriptions","organizations_url":"https://api.github.com/users/fish-shell/orgs","repos_url":"https://api.github.com/users/fish-shell/repos","events_url":"https://api.github.com/users/fish-shell/events{/privacy}","received_events_url":"https://api.github.com/users/fish-shell/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fish-shell/fish-shell","description":"The user-friendly command line shell.","fork":false,"url":"https://api.github.com/repos/fish-shell/fish-shell","forks_url":"https://api.github.com/repos/fish-shell/fish-shell/forks","keys_url":"https://api.github.com/repos/fish-shell/fish-shell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fish-shell/fish-shell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fish-shell/fish-shell/teams","hooks_url":"https://api.github.com/repos/fish-shell/fish-shell/hooks","issue_events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/events{/number}","events_url":"https://api.github.com/repos/fish-shell/fish-shell/events","assignees_url":"https://api.github.com/repos/fish-shell/fish-shell/assignees{/user}","branches_url":"https://api.github.com/repos/fish-shell/fish-shell/branches{/branch}","tags_url":"https://api.github.com/repos/fish-shell/fish-shell/tags","blobs_url":"https://api.github.com/repos/fish-shell/fish-shell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fish-shell/fish-shell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fish-shell/fish-shell/git/refs{/sha}","trees_url":"https://api.github.com/repos/fish-shell/fish-shell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fish-shell/fish-shell/statuses/{sha}","languages_url":"https://api.github.com/repos/fish-shell/fish-shell/languages","stargazers_url":"https://api.github.com/repos/fish-shell/fish-shell/stargazers","contributors_url":"https://api.github.com/repos/fish-shell/fish-shell/contributors","subscribers_url":"https://api.github.com/repos/fish-shell/fish-shell/subscribers","subscription_url":"https://api.github.com/repos/fish-shell/fish-shell/subscription","commits_url":"https://api.github.com/repos/fish-shell/fish-shell/commits{/sha}","git_commits_url":"https://api.github.com/repos/fish-shell/fish-shell/git/commits{/sha}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/comments{/number}","issue_comment_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments{/number}","contents_url":"https://api.github.com/repos/fish-shell/fish-shell/contents/{+path}","compare_url":"https://api.github.com/repos/fish-shell/fish-shell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fish-shell/fish-shell/merges","archive_url":"https://api.github.com/repos/fish-shell/fish-shell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fish-shell/fish-shell/downloads","issues_url":"https://api.github.com/repos/fish-shell/fish-shell/issues{/number}","pulls_url":"https://api.github.com/repos/fish-shell/fish-shell/pulls{/number}","milestones_url":"https://api.github.com/repos/fish-shell/fish-shell/milestones{/number}","notifications_url":"https://api.github.com/repos/fish-shell/fish-shell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/labels{/name}","releases_url":"https://api.github.com/repos/fish-shell/fish-shell/releases{/id}","deployments_url":"https://api.github.com/repos/fish-shell/fish-shell/deployments","created_at":"2012-05-10T03:00:55Z","updated_at":"2017-04-17T09:12:09Z","pushed_at":"2017-04-17T11:28:51Z","git_url":"git://github.com/fish-shell/fish-shell.git","ssh_url":"git@github.com:fish-shell/fish-shell.git","clone_url":"https://github.com/fish-shell/fish-shell.git","svn_url":"https://github.com/fish-shell/fish-shell","homepage":"http://fishshell.com","size":35547,"stargazers_count":7387,"watchers_count":7387,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":718,"mirror_url":null,"open_issues_count":429,"forks":718,"open_issues":429,"watchers":7387,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fish-shell/fish-shell/pulls/3960"},"html":{"href":"https://github.com/fish-shell/fish-shell/pull/3960"},"issue":{"href":"https://api.github.com/repos/fish-shell/fish-shell/issues/3960"},"comments":{"href":"https://api.github.com/repos/fish-shell/fish-shell/issues/3960/comments"},"review_comments":{"href":"https://api.github.com/repos/fish-shell/fish-shell/pulls/3960/comments"},"review_comment":{"href":"https://api.github.com/repos/fish-shell/fish-shell/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fish-shell/fish-shell/pulls/3960/commits"},"statuses":{"href":"https://api.github.com/repos/fish-shell/fish-shell/statuses/d813667fd8ae7141a66451774d5e94b6b1d0f211"}}}}
{"actor":{"display_login":"adambyrtek"}}