From patchwork Mon Sep 11 05:22:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 9946669 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D65EC6035D for ; Mon, 11 Sep 2017 05:25:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD25F28AF0 for ; Mon, 11 Sep 2017 05:25:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1BBD28AF4; Mon, 11 Sep 2017 05:25:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06BD228AF0 for ; Mon, 11 Sep 2017 05:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750789AbdIKFWz (ORCPT ); Mon, 11 Sep 2017 01:22:55 -0400 Received: from mgwym02.jp.fujitsu.com ([211.128.242.41]:63625 "EHLO mgwym02.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbdIKFWz (ORCPT ); Mon, 11 Sep 2017 01:22:55 -0400 Received: from yt-mxoi2.gw.nic.fujitsu.com (unknown [192.168.229.69]) by mgwym02.jp.fujitsu.com with smtp id 6c44_4539_def73e9f_9809_48ce_9f4e_506e52f65aaf; Mon, 11 Sep 2017 14:22:49 +0900 Received: from g01jpfmpwkw03.exch.g01.fujitsu.local (g01jpfmpwkw03.exch.g01.fujitsu.local [10.0.193.57]) by yt-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 8FEFFAC00C6 for ; Mon, 11 Sep 2017 14:22:48 +0900 (JST) Received: from g01jpexchkw37.g01.fujitsu.local (unknown [10.0.193.4]) by g01jpfmpwkw03.exch.g01.fujitsu.local (Postfix) with ESMTP id D72A5BD66A3 for ; Mon, 11 Sep 2017 14:22:47 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 913befd8c60a4e04aac33d76db8ba211 To: From: "Misono, Tomohiro" Subject: [PATCH] btrfs-progs: update btrfs-completion Message-ID: Date: Mon, 11 Sep 2017 14:22:43 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-US X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- btrfs-completion | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) 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 }