Skip to content

completion: Cleanup of Bash completion - #6710

Merged
swick merged 3 commits into
flatpak:mainfrom
electricbrass:bash-completion-fix
Jun 18, 2026
Merged

swick merged 3 commits into
flatpak:mainfrom
electricbrass:bash-completion-fix

Conversation

@electricbrass

@electricbrass electricbrass commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

This is the cleanup and bugfix parts only of #6678. I've split them off into a separate PR so that the fixes don't have to wait on my other PRs that don't actually matter to them.

All shellcheck warnings have been addressed, and 2 fixes have been made:

  1. i, RES and CUR are now local instead of global to prevent modifying user's shell session's state
  2. COMPGEN_OPTS is properly quoted, which is needed for the filters passed to compgen -X to be interpreted by compgen instead of directly by Bash when expanding COMPGEN_OPTS. This makes completion for flatpak install not just error out when failglob is enabled, and has the filter actually correctly match .flatpak and .flatpakref files in all cases.
Screencast.From.2026-06-08.21-39-53.mp4

Comment thread completion/flatpak
Comment thread completion/flatpak
A few global variables were being created unecessarily still. This makes
sure that users shell environments are not polluted by extra variables
and that the completion doesn't modify unrelated variables
1. Use $() command substitution instead of legacy `` style
2. Properly quote COMPGEN_OPTS
3. Use readarray instead of relying on word splitting
1. Removed unnecessary punctuation to help with readability
2. Loop over RES elements directly instead of indexing
3. Declare COMPGEN_OPTS only once vs redeclaring on each iteration
@swick
swick enabled auto-merge June 18, 2026 10:44
@swick
swick added this pull request to the merge queue Jun 18, 2026
Merged via the queue into flatpak:main with commit 02fc85a Jun 18, 2026
15 of 17 checks passed
@electricbrass
electricbrass deleted the bash-completion-fix branch June 23, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants