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 2BBB1A0582; Tue, 22 Nov 2022 16:22:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0516342D6D; Tue, 22 Nov 2022 16:22:23 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mails.dpdk.org (Postfix) with ESMTP id 854B7427EB for ; Tue, 22 Nov 2022 16:22:21 +0100 (CET) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 21A805C0037; Tue, 22 Nov 2022 10:22:21 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 22 Nov 2022 10:22:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1669130541; x= 1669216941; bh=xSQ6hUPxnwB6bJrMWXkpYhJUWUa0pZI62XQ87LNSagg=; b=P xqmFHpxPoDUr1I355DAEg/wTkiWqSVilmPcayJtEqNxfVMU+hSyB1GUtQJRbWHqV QFfzqQAeY/A3gHqzNs5hVR58DMSmbToU6ssPraRS0hYW/uzdu11zK/fqEidmS2Fx G215bimtlljknVN/GBdcMSiQ6HjFoOq3xcfU1cbBe38VH3QkGeRKEWOu9twNEqtN eq5jn5dXUS0u+3f0+l67zBRJX0yAga1DwrAMjNjRhvvZMe3rex6u7e+N53puJzII znrxMs4OWJCBpeU2mU+sCbpSSykUA0JJr1qrvyUmdp+n6B/0kzknxkohiQtVMDea haB3lB6OVv8Y+pDPcN1tA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1669130541; x= 1669216941; bh=xSQ6hUPxnwB6bJrMWXkpYhJUWUa0pZI62XQ87LNSagg=; b=j eIUe2+VQhMAvTxU6/pNdmSHSucrOda39mUpFTzZJWnDaiDKMFfSC6eQghSjN145O bzD7A75EMs+nQx7OL6B4y8H26jHudpfKci+nihU28lip2XpWo2HXRK8uIMZc9GK5 gHTZj0mV3U0dIZtxgNr1a31kpTup9GZ//8NjpSfzw4xrykhXsro1vxgWENQqzAlu ajn67B40HIlEJbshh5qNjAwIwulYQBWVU2WLtzu8DVZR56/viTaVEG3MZ6x/A0cO Y36gsc4iauXoYBH2mhuZPtcjcdQEPGkGVpfzCr66mW0M5ply3PeNrn8fn0fnk7HD UE6dLbXieCHRTcd8HdTyw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrheelgdeghecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnheptdejieeifeehtdffgfdvleetueeffeehueejgfeuteeftddtieek gfekudehtdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 22 Nov 2022 10:22:19 -0500 (EST) From: Thomas Monjalon To: Robin Jarry Cc: dev@dpdk.org, bruce.richardson@intel.com, stephen@networkplumber.org, dmitry.kozliuk@gmail.com Subject: Re: [PATCH] usertools/hugepages: show usage if no action specified Date: Tue, 22 Nov 2022 16:22:18 +0100 Message-ID: <4853392.0VBMTVartN@thomas> In-Reply-To: References: <20221104113018.4069058-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 07/11/2022 10:39, Robin Jarry: > Thomas Monjalon, Nov 04, 2022 at 12:30: > > Previously, the script was doing nothing if no argument was provided. > > > > If neither show, mount/unmount, clear/reserve are specified, > > it is assumed that the user does not know how to use the script. > > So the usage is printed and an error code is used in exit. > > The user will understand something is wrong, > > and can recall the script with the option -h to get more information. > > > > Signed-off-by: Thomas Monjalon > > --- > > usertools/dpdk-hugepages.py | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py > > index a22d504d3a..823cfcf185 100755 > > --- a/usertools/dpdk-hugepages.py > > +++ b/usertools/dpdk-hugepages.py > > @@ -272,6 +272,10 @@ def main(): > > args.reserve = args.setup > > args.mount = True > > > > + if not (args.show or args.mount or args.unmount or args.clear or args.reserve): > > + parser.print_usage() > > + sys.exit(1) > > Hi Thomas, > > I believe you can do: > > parser.error("at least one of -s/-c/-m/-u/-r/--setup is required") > > and omit sys.exit(1). > > $ ~/dev/dpdk/usertools/dpdk-hugepages.py > usage: dpdk-hugepages.py [-h] [--show] [--clear] [--mount] [--unmount] [--node NODE] [--pagesize SIZE] [--reserve SIZE] [--setup SIZE] > dpdk-hugepages.py: error: at least one of -s/-c/-m/-u/-r/--setup is required It is a long message and not long enough to be accurate (long options are missing). I would go with parser.error("no action specified")