]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredumpctl: fix bash completion matching
authorLuca Boccassi <bluca@debian.org>
Tue, 25 Apr 2023 14:30:00 +0000 (15:30 +0100)
committerLuca Boccassi <bluca@debian.org>
Sat, 29 Apr 2023 17:47:34 +0000 (18:47 +0100)
When multi-word matching string is quoted, __contains_word compares
it as a whole to the passed option, so it doesn't work.

shell-completion/bash/coredumpctl

index 5416e9e58a7318decf6b0b38fbc7de2e0baaa83b..3a02744541c79650e2c67d6e0897bf84f12e7af5 100644 (file)
@@ -47,16 +47,16 @@ _coredumpctl() {
         [DUMP]='dump debug'
     )
 
-    if __contains_word "$prev" '--output -o'; then
+    if __contains_word "$prev" --output -o; then
         comps=$( compgen -A file -- "$cur" )
         compopt -o filenames
-    elif __contains_word "$prev" '-D --directory'; then
+    elif __contains_word "$prev" -D --directory; then
         comps=$( compgen -A directory -- "$cur" )
         compopt -o filenames
     elif __contains_word "$prev" '--debugger'; then
         comps=$( compgen -A command -- "$cur" )
         compopt -o filenames
-    elif __contains_word "$prev" '--field -F'; then
+    elif __contains_word "$prev" --field -F; then
         comps=$( compgen -W '${__journal_fields[*]}' -- "$cur" )
     elif __contains_word "$prev" '--json'; then
         comps=$( compgen -W 'pretty short off' -- "$cur" )