mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-02 19:52:02 +00:00
btrfs-progs: update btrfs-completion
This patch updates btrfs-completion: - add "filesystem du" and "rescure zero-log" - restrict _btrfs_mnts to show btrfs type only - add more completion in last case statements (This file contains both spaces/tabs and may need cleanup.) Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5768fc03a4
commit
86529862e1
@ -16,7 +16,7 @@ _btrfs_mnts()
|
|||||||
local MNTS
|
local MNTS
|
||||||
MNTS=''
|
MNTS=''
|
||||||
while read mnt; do MNTS+="$mnt "
|
while read mnt; do MNTS+="$mnt "
|
||||||
done < <(mount | awk '{print $3}')
|
done < <(mount -t btrfs | awk '{print $3}')
|
||||||
COMPREPLY+=( $( compgen -W "$MNTS" -- "$cur" ) )
|
COMPREPLY+=( $( compgen -W "$MNTS" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,11 +31,11 @@ _btrfs()
|
|||||||
|
|
||||||
commands='subvolume filesystem balance device scrub check rescue restore inspect-internal property send receive quota qgroup replace help version'
|
commands='subvolume filesystem balance device scrub check rescue restore inspect-internal property send receive quota qgroup replace help version'
|
||||||
commands_subvolume='create delete list snapshot find-new get-default set-default show sync'
|
commands_subvolume='create delete list snapshot find-new get-default set-default show sync'
|
||||||
commands_filesystem='defragment sync resize show df label usage'
|
commands_filesystem='defragment sync resize show df du label usage'
|
||||||
commands_balance='start pause cancel resume status'
|
commands_balance='start pause cancel resume status'
|
||||||
commands_device='scan add delete remove ready stats usage'
|
commands_device='scan add delete remove ready stats usage'
|
||||||
commands_scrub='start cancel resume status'
|
commands_scrub='start cancel resume status'
|
||||||
commands_rescue='chunk-recover super-recover'
|
commands_rescue='chunk-recover super-recover zero-log'
|
||||||
commands_inspect_internal='inode-resolve logical-resolve subvolid-resolve rootid min-dev-size dump-tree dump-super tree-stats'
|
commands_inspect_internal='inode-resolve logical-resolve subvolid-resolve rootid min-dev-size dump-tree dump-super tree-stats'
|
||||||
commands_property='get set list'
|
commands_property='get set list'
|
||||||
commands_quota='enable disable rescan'
|
commands_quota='enable disable rescan'
|
||||||
@ -114,6 +114,10 @@ _btrfs()
|
|||||||
_filedir
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
df|usage)
|
||||||
|
_btrfs_mnts
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
label)
|
label)
|
||||||
_btrfs_mnts
|
_btrfs_mnts
|
||||||
_btrfs_devs
|
_btrfs_devs
|
||||||
@ -125,6 +129,26 @@ _btrfs()
|
|||||||
_btrfs_devs
|
_btrfs_devs
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
inspect-internal)
|
||||||
|
case $prev in
|
||||||
|
min-dev-size)
|
||||||
|
_btrfs_mnts
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
rootid)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
receive)
|
||||||
|
case $prev in
|
||||||
|
-f)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
replace)
|
replace)
|
||||||
case $prev in
|
case $prev in
|
||||||
status|cancel)
|
status|cancel)
|
||||||
@ -137,14 +161,17 @@ _btrfs()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
subvolume)
|
||||||
|
case $prev in
|
||||||
|
list)
|
||||||
|
_btrfs_mnts
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$cmd" == "receive" && "$prev" == "-f" ]]; then
|
|
||||||
_filedir
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
_filedir -d
|
_filedir -d
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user