New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terraform command completions #3960
Changes from 1 commit
f11ddea
fd817b5
c688618
1e7ce69
b32e5ab
d813667
f7b0d43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
function __fish_terraform_needs_command | ||
set cmd (commandline -opc) | ||
if [ (count $cmd) -eq 1 ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idiomatic fish way to do this is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is not needed anymore. |
||
return 0 | ||
end | ||
|
||
for arg in $cmd[2..-1] | ||
switch $arg | ||
case '--*' | ||
# ignore global flags | ||
case '*' | ||
return 1 | ||
end | ||
end | ||
return 0 | ||
end | ||
|
||
# general options | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -l version -d 'Print version information' | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -l help -d 'Show help' | ||
|
||
### apply | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a apply -d 'Builds or changes infrastructure' | ||
|
||
### console | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a console -d 'Interactive console for Terraform interpolations' | ||
|
||
### destroy | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a destroy -d 'Destroy Terraform-managed infrastructure' | ||
|
||
### env | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a env -d 'Environment management' | ||
|
||
### fmt | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a fmt -d 'Rewrites config files to canonical format' | ||
|
||
### get | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a get -d 'Download and install modules for the configuration' | ||
|
||
### graph | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a graph -d 'Create a visual graph of Terraform resources' | ||
|
||
### import | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a import -d 'Import existing infrastructure into Terraform' | ||
|
||
### init | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a init -d 'Initialize a new or existing Terraform configuration' | ||
|
||
### output | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a output -d 'Read an output from a state file' | ||
|
||
### plan | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a plan -d 'Generate and show an execution plan' | ||
|
||
### push | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a push -d 'Upload this Terraform module to Atlas to run' | ||
|
||
### refresh | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a refresh -d 'Update local state file against real resources' | ||
|
||
### show | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a show -d 'Inspect Terraform state or plan' | ||
|
||
### taint | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a taint -d 'Manually mark a resource for recreation' | ||
|
||
### untaint | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a untaint -d 'Manually unmark a resource as tainted' | ||
|
||
### validate | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a validate -d 'Validates the Terraform files' | ||
|
||
### version | ||
complete -f -c terraform -n '__fish_terraform_needs_command' -a version -d 'Prints the Terraform version' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general you should use local variables to avoid modifying a global var by the same name; i.e.,
set -l cmd...
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not needed anymore.