From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8449BA0540; Fri, 9 Sep 2022 11:37:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6C1FE42BA3; Fri, 9 Sep 2022 11:35:59 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id F165D42B91 for ; Fri, 9 Sep 2022 11:35:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662716156; x=1694252156; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ttJeebfNbU0R3tb1VJ8XmZ4ZDVQe9iMX6HX8upVLNJ0=; b=K6qOSR+dWVSObkdnkdXthFW9+S4eeFlOEHDgDKIIC2zSQt6sD7sIw3Jp MmgiwKjfvRAhoYx5wA1IgM9TcJI3QXwB+NR/4gXP9TcNX1+naHdLpuHCP 8IbQHtZif2mQNR54JZ7NK7JUpIZE3MVWapXvpNxxG+hHvXias6lVE5n/a t2ynppJaqDuRGK8gbxIQA3eR5+6vcq3x3sRWhKv2e1BnsRg2FX4NSvQiw A1Jen7njawlXfT6S/WSEcx/G7yfCCDeH+Mebe6Kn6UK1yNxuQ0x8zWDcA qmIb+VbzUFzPffoOeVJlLI7h8WQSAbH21SOIdAY34ZFBYnMmA7bXwRzdy A==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="297437157" X-IronPort-AV: E=Sophos;i="5.93,302,1654585200"; d="scan'208";a="297437157" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2022 02:35:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,302,1654585200"; d="scan'208";a="740996457" Received: from silpixa00401385.ir.intel.com ([10.237.214.161]) by orsmga004.jf.intel.com with ESMTP; 09 Sep 2022 02:35:54 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Ciara Power , =?UTF-8?q?Morten=20Br=C3=B8rup?= Subject: [PATCH v3 13/13] telemetry: make help command more helpful Date: Fri, 9 Sep 2022 10:35:23 +0100 Message-Id: <20220909093523.471727-14-bruce.richardson@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220909093523.471727-1-bruce.richardson@intel.com> References: <20220623164245.561371-1-bruce.richardson@intel.com> <20220909093523.471727-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The /help telemetry command prints out the help text for the given command passed in as parameter. However, entering /help without any parameters does not give any useful information as to the fact that you need to pass in a command to get help on. Update the command so it prints its own help text when called without any parameters. Signed-off-by: Bruce Richardson Acked-by: Ciara Power Acked-by: Morten Brørup --- lib/telemetry/telemetry.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index cf60d27bd4..09febff0ae 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -139,15 +139,17 @@ command_help(const char *cmd __rte_unused, const char *params, struct rte_tel_data *d) { int i; + /* if no parameters return our own help text */ + const char *to_lookup = (params == NULL ? cmd : params); - if (!params) - return -1; rte_tel_data_start_dict(d); rte_spinlock_lock(&callback_sl); for (i = 0; i < num_callbacks; i++) - if (strcmp(params, callbacks[i].cmd) == 0) { - rte_tel_data_add_dict_string(d, params, - callbacks[i].help); + if (strcmp(to_lookup, callbacks[i].cmd) == 0) { + if (params == NULL) + rte_tel_data_string(d, callbacks[i].help); + else + rte_tel_data_add_dict_string(d, params, callbacks[i].help); break; } rte_spinlock_unlock(&callback_sl); -- 2.34.1