Skip to content

Fix filename completion for commands with path arguments - #13733

Merged
tanmay-hc merged 1 commit into
hashicorp:mainfrom
akasakariko:fix/12466-filename-completion
Oct 27, 2026
Merged

tanmay-hc merged 1 commit into
hashicorp:mainfrom
akasakariko:fix/12466-filename-completion

Conversation

@akasakariko

@akasakariko akasakariko commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Restore filename completion after packer -autocomplete-install by using complete.PredictFiles("*") for commands with positional path arguments instead of complete.PredictNothing

  • Complete both files and directories for build, console, fix, fmt, hcl2_upgrade, init, inspect, validate, and verify-attestation
  • Preserve existing command and flag completion without changing template parsing or command execution
  • Add one shared regression test and a changelog entry

Resolved Issues

Closes #12466

Validation

Reproduced the reported behavior with Packer 1.9.1 in interactive Bash 3.2.57 and 5.3.20 using the same complete -C registration generated by the installer

The patched binary completes packer build ubuntu-arm64.qemu<Tab> to ubuntu-arm64.qemu.pkr.hcl in both shells while preserving packer bui<Tab>

Passed locally with Go 1.26.10 on macOS arm64

  • go test ./command -run '^TestAutocompleteArgs$' -count=1
  • TEST=./command/... VET=./command/... make test including vet
  • go build -o bin/packer .
  • make fmt and make fmt-check
  • make ci-lint
  • git diff --cached --check
  • CLI completion smoke checks for all nine commands, directories, command names, flag names, and -var-file values

Unfiltered golangci-lint run ./command/... reports 90 existing findings
Running the same check against a clean source snapshot of base commit 5f7680f77c9fcacff909f1dfdfa20113e03deee1 produced the same 90 findings with no added or removed diagnostics

GitHub Actions currently reports action_required for both Go Test and Go Validate with no jobs executed
Remote CI results are pending maintainer action

Cloud acceptance tests were not run
Code generation is not applicable because no configuration structs or generated sources changed

Rollback Plan

Revert this change

Changes to Security Controls

None

@akasakariko
akasakariko requested a review from a team as a code owner October 27, 2026 00:36

@tanmay-hc tanmay-hc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising the PR. I've tested them and changes looks good to me.

@tanmay-hc
tanmay-hc merged commit 7519ede into hashicorp:main Oct 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'packer -autocomplete-install' breaks filename completion

2 participants