summaryrefslogtreecommitdiff
path: root/btrfs-completion
diff options
context:
space:
mode:
authorMisono, Tomohiro <misono.tomohiro@jp.fujitsu.com>2017-09-11 14:22:43 +0900
committerDavid Sterba <dsterba@suse.com>2017-09-25 15:17:11 +0200
commit86529862e1ff1b1b27aafc207b75b0c851fbfd34 (patch)
treeae6bb290f28bff6a4ebc6bd6bcdcae1394d02446 /btrfs-completion
parent5768fc03a459146d356d4d91e84bd496c772d437 (diff)
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>
Diffstat (limited to 'btrfs-completion')
-rw-r--r--btrfs-completion43
1 files changed, 35 insertions, 8 deletions
diff --git a/btrfs-completion b/btrfs-completion
index 3ede77b6..1f00add0 100644
--- a/btrfs-completion
+++ b/btrfs-completion
@@ -16,7 +16,7 @@ _btrfs_mnts()
local MNTS
MNTS=''
while read mnt; do MNTS+="$mnt "
- done < <(mount | awk '{print $3}')
+ done < <(mount -t btrfs | awk '{print $3}')
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='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_device='scan add delete remove ready stats usage'
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_property='get set list'
commands_quota='enable disable rescan'
@@ -114,6 +114,10 @@ _btrfs()
_filedir
return 0
;;
+ df|usage)
+ _btrfs_mnts
+ return 0
+ ;;
label)
_btrfs_mnts
_btrfs_devs
@@ -125,6 +129,26 @@ _btrfs()
_btrfs_devs
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)
case $prev in
status|cancel)
@@ -137,14 +161,17 @@ _btrfs()
;;
esac
;;
+ subvolume)
+ case $prev in
+ list)
+ _btrfs_mnts
+ return 0
+ ;;
+ esac
+ ;;
esac
fi
- if [[ "$cmd" == "receive" && "$prev" == "-f" ]]; then
- _filedir
- return 0
- fi
-
_filedir -d
return 0
}