Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools: ynl-gen-c: annotate valid choices for --mode

This makes argparse validate the input and helps users
understand which modes are possible.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20241206113100.e2ab5cf6937c.Ie149a0ca5df713860964b44fe9d9ae547f2e1553@changeid
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Johannes Berg and committed by
Jakub Kicinski
00ab2467 860dbab6

+2 -1
+2 -1
tools/net/ynl/ynl-gen-c.py
··· 2706 2706 2707 2707 def main(): 2708 2708 parser = argparse.ArgumentParser(description='Netlink simple parsing generator') 2709 - parser.add_argument('--mode', dest='mode', type=str, required=True) 2709 + parser.add_argument('--mode', dest='mode', type=str, required=True, 2710 + choices=('user', 'kernel', 'uapi')) 2710 2711 parser.add_argument('--spec', dest='spec', type=str, required=True) 2711 2712 parser.add_argument('--header', dest='header', action='store_true', default=None) 2712 2713 parser.add_argument('--source', dest='header', action='store_false')