[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241206113100.e2ab5cf6937c.Ie149a0ca5df713860964b44fe9d9ae547f2e1553@changeid>
Date: Fri, 6 Dec 2024 11:30:56 +0100
From: Johannes Berg <johannes@...solutions.net>
To: netdev@...r.kernel.org
Cc: Johannes Berg <johannes.berg@...el.com>
Subject: [PATCH net-next 1/2] tools: ynl-gen-c: annotate valid choices for --mode
From: Johannes Berg <johannes.berg@...el.com>
This makes argparse validate the input and helps users
understand which modes are possible.
Signed-off-by: Johannes Berg <johannes.berg@...el.com>
---
tools/net/ynl/ynl-gen-c.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index d8201c4b1520..50ec03056863 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -2635,7 +2635,8 @@ def find_kernel_root(full_path):
def main():
parser = argparse.ArgumentParser(description='Netlink simple parsing generator')
- parser.add_argument('--mode', dest='mode', type=str, required=True)
+ parser.add_argument('--mode', dest='mode', type=str, required=True,
+ choices=('user', 'kernel', 'uapi'))
parser.add_argument('--spec', dest='spec', type=str, required=True)
parser.add_argument('--header', dest='header', action='store_true', default=None)
parser.add_argument('--source', dest='header', action='store_false')
--
2.47.1
Powered by blists - more mailing lists