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 A75D7A0093; Mon, 7 Nov 2022 10:40:05 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8448640156; Mon, 7 Nov 2022 10:40:05 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 0700440151 for ; Mon, 7 Nov 2022 10:40:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667814003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ek6hv8NWN7PTxzkVsqtd25CDKISgflMJNji3NNLOX2s=; b=C7VdTlKky0YW8fOV9Mo1AJcFyeBw4A1wVs+WtCVHi+5JVcxKAVgSIHzQQlDDWuCIYDoSWP vKubT9z1758vQ358s1H6PgILwy9cKSPd77LCMHg0g8BgxzZJ4vR6N+/5T4mFlLFFFhXgm0 9Nv0qe6/2v43eK5SSm2hOntiQEuNmp4= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-397-bbcBjirpMn25KGoypCOjuA-1; Mon, 07 Nov 2022 04:40:02 -0500 X-MC-Unique: bbcBjirpMn25KGoypCOjuA-1 Received: by mail-wr1-f71.google.com with SMTP id k1-20020adfb341000000b00238745c9b1aso2489444wrd.5 for ; Mon, 07 Nov 2022 01:40:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Ek6hv8NWN7PTxzkVsqtd25CDKISgflMJNji3NNLOX2s=; b=cfDxnBr7We3eb/AAlvJe7qH5xHzk5L3Hgn1OdQdmTI0aElJ0mdeinel1u6VvKt9FOi qOGeS83OEPnfvk1kOvXsCjWaBHEgnHfI71iS93NHaC6KqzuQS9M1OSjPFlXHLn4712Le QOsZH6LnbrpdAgHGhb0y5eLvdqTUdYlOqxwUBojjS2J20p/vBWygO4PgjulzBU+xcJFX cmYG7fQ0s55QLSvXUHnP+oMoWMY/p0PcURfwl8iJW5ecm714gGJIVC1oCWWh3bbcX/3G DANXJor5jaAdc5W7L+DSN88MDx8Wb6egs0w+dkKXb696YWz9m+fQQca425Dv9JziB2LV aBBg== X-Gm-Message-State: ACrzQf36ixEAt2hXuUcnlX69eh+ikMH4n+CzzVIUy4VP8vTTXw1KI0rZ kpBqcREKctoGD0vLnY8R3CezidbtuHHpo8a4athe30NHrCX3TCYZPprSuDGOuAiPPjZEEmSLeZY /9u0= X-Received: by 2002:a05:6000:810:b0:236:8a6d:e4e1 with SMTP id bt16-20020a056000081000b002368a6de4e1mr30613504wrb.661.1667814000969; Mon, 07 Nov 2022 01:40:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM7BEZK3S/HQeuV8h8jk73swJhrnACpFyH9M3zu2wLjSIXeso0EGSU6ADKe+/XhtB65MepHBCg== X-Received: by 2002:a05:6000:810:b0:236:8a6d:e4e1 with SMTP id bt16-20020a056000081000b002368a6de4e1mr30613495wrb.661.1667814000787; Mon, 07 Nov 2022 01:40:00 -0800 (PST) Received: from localhost (2a01cb000f483e0055ae3800781b5cbc.ipv6.abo.wanadoo.fr. [2a01:cb00:f48:3e00:55ae:3800:781b:5cbc]) by smtp.gmail.com with ESMTPSA id u8-20020adfeb48000000b002366b17ca8bsm7923263wrn.108.2022.11.07.01.40.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Nov 2022 01:40:00 -0800 (PST) Mime-Version: 1.0 Date: Mon, 07 Nov 2022 10:39:59 +0100 Message-Id: Cc: , , Subject: Re: [PATCH] usertools/hugepages: show usage if no action specified From: "Robin Jarry" To: "Thomas Monjalon" , X-Mailer: aerc/0.13.0-41-g9921b33679f6-dirty References: <20221104113018.4069058-1-thomas@monjalon.net> In-Reply-To: <20221104113018.4069058-1-thomas@monjalon.net> X-Mimecast-Spam-Score: 1 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 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 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 =3D args.setup > args.mount =3D True > =20 > + if not (args.show or args.mount or args.unmount or args.clear or arg= s.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] [--n= ode NODE] [--pagesize SIZE] [--reserve SIZE] [--setup SIZE] dpdk-hugepages.py: error: at least one of -s/-c/-m/-u/-r/--setup is require= d