From patchwork Tue Sep 14 13:23:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 12493393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E20C433FE for ; Tue, 14 Sep 2021 13:23:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 45C9B610E6 for ; Tue, 14 Sep 2021 13:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232989AbhINNY7 (ORCPT ); Tue, 14 Sep 2021 09:24:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbhINNY6 (ORCPT ); Tue, 14 Sep 2021 09:24:58 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40B24C061574 for ; Tue, 14 Sep 2021 06:23:41 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id v24so13675090eda.3 for ; Tue, 14 Sep 2021 06:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bDE5H6ouGRCAEZ9YfNrgle8dTCkLnHF61NMoDExWoeY=; b=gA5GWGhoa9y6k9KREmWvRE5ugYpai+uEYYmcjMiwGYdJTsKlnIj2w5fKvu4uJqyFmy f4KZOxWwGW0htoJjIDOvTwLxvIaonlWg+6/bxptzIJLaE8SEUEZd+yaQ7FvH3ATmJCpV //4GIcayOaaVyXCnJnE3ab7adhy27XkboJ0hr6SoaEceZFakvcclJRF9QzOsq2jbR+Nn 91HYdGFx7AfGCWcom6xmpKwkVy6F9PWsEmrR9hPAatcJF1R1oFCHIA/5bqfHSKncrcQE kJAg7gZeFNegu9xzrMrY+DqFrfAjiXgFFnBL1MbnJtOlEUGpHq1EK70CuEGvGgPiR+dz E66w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bDE5H6ouGRCAEZ9YfNrgle8dTCkLnHF61NMoDExWoeY=; b=GEa42j9HKAca/73j5uY/uhaFhibJjzQR285eTVyPdYWFCsjScnadXojYknIBZrfObW uVRpXO5OzpyJUzPyf5oRTmZZ1lhWeFL4EFJdIzLcsRPxQMymM2DbpoXn014OOkFmWrby 6CPXYv6mIhtkUzuVvGaMUPoDGp75cYMcPo1KyfcxNybH5tBFm4YtynZI5jKunp3+/FQT sDnHkaVgrhGMcxYdXO72egwOMAfP5BMaKThWoPWRNqSAfoDbsbFAwf8eKW8RVlzw/T/X k2yzd5WMaYkHEAHveliATVdApwBqLq37Gi9jOsl1VMJfKFWRzdgW7lsFVLe38txG76qt z71Q== X-Gm-Message-State: AOAM533wp3uj9nhHm0h59ZFytewO8r9j0I94A/C+U2bzqItfeHcgmMv7 G+mnU8nPY8UJv3AaNG7clWOyEb4S1z8= X-Google-Smtp-Source: ABdhPJz+bM8ck/PPz1hw5l6i+ThduyKOMgC63+wSWvKwOLq74jA6XkB7EKZfJY5Cm5PIpx3xhSZK1g== X-Received: by 2002:a05:6402:1438:: with SMTP id c24mr19942345edx.22.1631625819930; Tue, 14 Sep 2021 06:23:39 -0700 (PDT) Received: from oberon.zico.biz ([83.222.187.186]) by smtp.gmail.com with ESMTPSA id h10sm5689970edf.85.2021.09.14.06.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 06:23:39 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v2 1/4] trace-cmd: Update bash completion Date: Tue, 14 Sep 2021 16:23:34 +0300 Message-Id: <20210914132337.3969125-2-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210914132337.3969125-1-tz.stoyanov@gmail.com> References: <20210914132337.3969125-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Added convert subcommand and its arguments to bash completion logic. Signed-off-by: Tzvetomir Stoyanov (VMware) --- tracecmd/trace-cmd.bash | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tracecmd/trace-cmd.bash b/tracecmd/trace-cmd.bash index b01c7a07..6639c143 100644 --- a/tracecmd/trace-cmd.bash +++ b/tracecmd/trace-cmd.bash @@ -64,6 +64,13 @@ plugin_options() COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) } +compression_param() +{ + local opts=$(trace-cmd list -c | grep -v 'Supported' | cut -d "," -f1) + opts+=" any none " + COMPREPLY=( $(compgen -W "${opts}") ) +} + __trace_cmd_list_complete() { local prev=$1 @@ -181,6 +188,9 @@ __trace_cmd_record_complete() cmd_options record "$cur" fi ;; + --compression) + compression_param + ;; *) # stream start and profile do not show all options cmd_options record "$cur" @@ -222,6 +232,29 @@ __trace_cmd_dump_complete() esac } +__trace_cmd_convert_complete() +{ + local prev=$1 + local cur=$2 + shift 2 + local words=("$@") + + case "$prev" in + -i) + __show_files + ;; + -o) + __show_files + ;; + --compression) + compression_param + ;; + *) + cmd_options convert "$cur" + ;; + esac +} + __show_command_options() { local command="$1" @@ -298,6 +331,10 @@ _trace_cmd_complete() __trace_cmd_dump_complete "${prev}" "${cur}" ${words[@]} return 0 ;; + convert) + __trace_cmd_convert_complete "${prev}" "${cur}" ${words[@]} + return 0 + ;; *) __show_command_options "$w" "${prev}" "${cur}" ;;