'packer -autocomplete-install' breaks filename completion
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
#### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
#### Overview of the Issue
Running
```
packer -autocomplete-install
```
works to add `packer ` completion such as the `build` command, but breaks the more useful filename autocompletion in bash on Mac (using both stock `3.2.57(1)-release` and newer brew installed Bash `5.2.15(1)-release` - with the same result)
#### Reproduction Steps
```
git clone https://github.com/HariSekhon/Packer-templates pack
cd pack
packer build ubuntu-arm64.qemu
# works to fill in the rest of the filename
```
```
packer -autocomplete-install
bash -login # to get the .bash_profile injected complete command to run
packer bui # now works to autocomplete the 'build' command
# but
packer build ubuntu-arm64.qemu # no longer autocompletes the filename
```
Workaround - remove packer autocompletion:
```
complete -r packer
packer build ubuntu-arm64.qemu # now works again
```
Permanently remove this broken autocompletion:
```
rm -fv /usr/local/etc/bash_completion.d/packer
rm -fv /opt/homebrew/etc/bash_completion.d/packer
gsed -i '/^complete.*packer packer$/d' ~/.bash_profile
```
### Packer version
```
packer version
Packer v1.9.1
```
### Operating system and Environment details
`Mac M1 running macOS Ventura 13.4`
&
`Mac Intel running macOS Big Sur 11.7`
using both Bash `3.2.57(1)-release` and `5.2.15(1)-release`
Contributor guide
Assessment
This issue has not been assessed yet.