From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: rjarry@redhat.com, bruce.richardson@intel.com,
stephen@networkplumber.org, dmitry.kozliuk@gmail.com
Subject: [PATCH v2] usertools/hugepages: show usage if no action specified
Date: Tue, 22 Nov 2022 16:32:38 +0100 [thread overview]
Message-ID: <20221122153238.2373095-1-thomas@monjalon.net> (raw)
In-Reply-To: <20221104113018.4069058-1-thomas@monjalon.net>
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 and an error message are printed.
The exit code will be non-zero.
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 <thomas@monjalon.net>
---
v2: replace parser.print_usage() and sys.exit(1) with parser.error()
---
usertools/dpdk-hugepages.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py
index a22d504d3a..bf2575ba36 100755
--- a/usertools/dpdk-hugepages.py
+++ b/usertools/dpdk-hugepages.py
@@ -272,6 +272,9 @@ 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.error("no action specified")
+
if args.pagesize:
pagesize_kb = get_memsize(args.pagesize)
else:
--
2.36.1
next prev parent reply other threads:[~2022-11-22 15:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 11:30 [PATCH] " Thomas Monjalon
2022-11-07 9:39 ` Robin Jarry
2022-11-22 15:22 ` Thomas Monjalon
2022-11-22 15:32 ` Thomas Monjalon [this message]
2022-11-22 15:38 ` [PATCH v2] " David Marchand
2022-11-22 15:42 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221122153238.2373095-1-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=dmitry.kozliuk@gmail.com \
--cc=rjarry@redhat.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).