forked from Mirrors/btrfs-progs
btrfs-progs: completion: use _filedir to replace _btrfs_devs
For developers it's pretty common to call "btrfs check" on a raw image dump other than real block device. It's also possible to end users to do some tests on loop devices. So current _btrfs_devs() is really making things worse. Use _filedir() to replace _btrfs_devs() so it can complete any filenames, no matter if it's just a file or a real block device. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>master
parent
9f45658fd2
commit
26300de037
|
@ -4,13 +4,6 @@
|
||||||
# (http://lists.alioth.debian.org/pipermail/bash-completion-devel/2013-June/004868.html)
|
# (http://lists.alioth.debian.org/pipermail/bash-completion-devel/2013-June/004868.html)
|
||||||
# edited by John C F <john.ch.fr at gmail.com> on 2015-02-02
|
# edited by John C F <john.ch.fr at gmail.com> on 2015-02-02
|
||||||
|
|
||||||
_btrfs_devs()
|
|
||||||
{
|
|
||||||
local DEVS
|
|
||||||
DEVS=''; while read dev; do DEVS+="$dev "; done < <(lsblk -pnro name)
|
|
||||||
COMPREPLY+=( $( compgen -W "$DEVS" -- "$cur" ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_btrfs_mnts()
|
_btrfs_mnts()
|
||||||
{
|
{
|
||||||
local MNTS
|
local MNTS
|
||||||
|
@ -68,14 +61,14 @@ _btrfs()
|
||||||
opts="$commands_scrub"
|
opts="$commands_scrub"
|
||||||
;;
|
;;
|
||||||
check)
|
check)
|
||||||
_btrfs_devs
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
rescue)
|
rescue)
|
||||||
opts="$commands_rescue"
|
opts="$commands_rescue"
|
||||||
;;
|
;;
|
||||||
restore)
|
restore)
|
||||||
_btrfs_devs
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
inspect-internal)
|
inspect-internal)
|
||||||
|
@ -120,13 +113,13 @@ _btrfs()
|
||||||
;;
|
;;
|
||||||
label)
|
label)
|
||||||
_btrfs_mnts
|
_btrfs_mnts
|
||||||
_btrfs_devs
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
device|rescue)
|
device|rescue)
|
||||||
_btrfs_devs
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
inspect-internal)
|
inspect-internal)
|
||||||
|
@ -156,7 +149,7 @@ _btrfs()
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
start)
|
start)
|
||||||
_btrfs_devs
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue