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 216DEA00C4; Mon, 25 Jul 2022 18:37:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8DB84280B; Mon, 25 Jul 2022 18:36:38 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id AE2C64280B for ; Mon, 25 Jul 2022 18:36:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658766997; x=1690302997; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o4JqiESRzUpvj53szCHZ4ZhHLo/poJuQ0zmzj/oIa0c=; b=lCZ1B/TDl2AuIDvrtsqcGsLGJ1Q8Z8QnTr+EE01toMAE+dkpFN+sNoz8 hHoi+CGJZThe/aX8v+h9ZJ/6DKfe5ZICd3E4UbsgZOIH/P/mInfmiHFTM XxALT1/mKzmiEBpeyQOrr1XF9goMHO3cUqCqw2APVJROSreG2xi+9LDMg z2KaEnaRdoIJHl3OT+t6TxthoQOJE3dpSaCe8VBdHsOxt1kmNFb43Qt6a Lu9y4V9pNqip/xrr+TUPg/xQTF6EfW4VMDskbNqLs9Rzl8uT4EdrBP+va 4CtpIEQYK5eSFVfEDR0QlTq4bHYLvNPs3XcDYJgyhkfLGUnrpRW/XdBBT Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10419"; a="288499152" X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="288499152" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2022 09:36:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="575122771" Received: from silpixa00401385.ir.intel.com (HELO silpixa00401385.ger.corp.intel.com.) ([10.237.223.47]) by orsmga006.jf.intel.com with ESMTP; 25 Jul 2022 09:36:36 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Ciara Power Subject: [PATCH v2 13/13] telemetry: make help command more helpful Date: Mon, 25 Jul 2022 17:35:42 +0100 Message-Id: <20220725163543.875775-14-bruce.richardson@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220725163543.875775-1-bruce.richardson@intel.com> References: <20220623164245.561371-1-bruce.richardson@intel.com> <20220725163543.875775-1-bruce.richardson@intel.com> MIME-Version: 1.0 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 --- 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