diff options
author | Matthew Leeds <matthew.leeds@endlessm.com> | 2018-05-03 16:05:07 -0700 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-14 07:35:26 +0000 |
commit | 9d9758c36dbfcad61a9a850f8a4b1e7dc6306141 (patch) | |
tree | 5af05c3d3b85fd42665fec9a198a92886027ebd6 /completion | |
parent | cdf7c459b8418142723ce4c4c3fa4651ebb682ac (diff) | |
download | flatpak-9d9758c36dbfcad61a9a850f8a4b1e7dc6306141.tar.gz |
completion: Only show files with the correct prefix
Currently flatpak's bash completion is a bit broken. It shows all files
with the appropriate extension (.flatpak or .flatpakref) rather than
just the ones starting with the characters you've already typed. So this
commit fixes that behavior by using the -X compgen option rather than
-G. For example, here's the old behavior:
$ flatpak install e<TAB>
bijiben.flatpak eos eos-runtimes
builder.flatpak eos-apps eos-sdk
and here's the new behavior:
$ flatpak install e<TAB>
eos eos-apps eos-runtimes eos-sdk
$ flatpak install b<TAB>
bijiben.flatpak builder.flatpak
Closes: #1645
Approved by: alexlarsson
Diffstat (limited to 'completion')
-rwxr-xr-x | completion/flatpak | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/completion/flatpak b/completion/flatpak index b90ef092..08f7353f 100755 --- a/completion/flatpak +++ b/completion/flatpak @@ -13,9 +13,9 @@ __flatpak() { if [[ "${RES[$i]}" = "__FLATPAK_FILE" ]]; then declare -a COMPGEN_OPTS=('-f') elif [[ "${RES[$i]}" = "__FLATPAK_BUNDLE_FILE" ]]; then - declare -a COMPGEN_OPTS=('-f' '-G' '*.flatpak') + declare -a COMPGEN_OPTS=('-f' '-X' '!*.flatpak') elif [[ "${RES[$i]}" = "__FLATPAK_BUNDLE_OR_REF_FILE" ]]; then - declare -a COMPGEN_OPTS=('-f' '-G' '*.flatpak@(|ref)') + declare -a COMPGEN_OPTS=('-f' '-X' '!*.flatpak@(|ref)') elif [[ "${RES[$i]}" = "__FLATPAK_DIR" ]]; then declare -a COMPGEN_OPTS=('-d') else |