diff mbox

btrfs-progs: update btrfs-completion

Message ID b5719816-3e51-e3fa-454c-f0da71bfe75d@jp.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Misono Tomohiro Sept. 11, 2017, 5:22 a.m. UTC
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>
---
 btrfs-completion | 43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)

Comments

David Sterba Sept. 11, 2017, 6:58 p.m. UTC | #1
On Mon, Sep 11, 2017 at 02:22:43PM +0900, Misono, Tomohiro wrote:
> 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>

Applied, thanks. Feel free to send the whitespace cleanup patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/btrfs-completion b/btrfs-completion
index 3ede77b..1f00add 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
 }