]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
bash-completion: add fallback to filename expansion for umount
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Thu, 28 Aug 2025 03:26:42 +0000 (23:26 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Thu, 28 Aug 2025 03:41:42 +0000 (23:41 -0400)
If the user defined path can not be found in the mount table
fallback to simple filename expansion.

Addresses: #1333
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
bash-completion/umount

index 35e86d9090068f04f9e41f2891f9687358882a5a..9ea126bacf46859d886c5a10caea6e0af447ce1c 100644 (file)
@@ -83,7 +83,13 @@ _umount_module()
                        ;;
        esac
 
-       local IFS=$'\n'
-       COMPREPLY=( $( compgen -W '$( _umount_points_list )'  -- "$cur" ) )
+       if command grep -q "^$cur" <(findmnt -lno TARGET); then
+               local IFS=$'\n'
+               COMPREPLY=( $( compgen -W '$( _umount_points_list )'  -- "$cur" ) )
+       else
+               compopt -o filenames
+               COMPREPLY=( $(compgen -o dirnames -- "$cur") )
+               return 0
+       fi
 }
 complete -F _umount_module -o nospace umount