diff options
author | Daniil Baturin <daniil@baturin.org> | 2023-04-28 17:57:29 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2023-05-04 01:45:53 +0100 |
commit | 6d4caef050a1aefbddbdae3ad3d3928e464426f1 (patch) | |
tree | 0755cde3bc48124917233ab4129bca2a14c3ecb7 /python/vyos | |
parent | 6e7dfd008ae8cd41abb6c12fa58c5dd8374ccba0 (diff) | |
download | vyos-1x-6d4caef050a1aefbddbdae3ad3d3928e464426f1.tar.gz vyos-1x-6d4caef050a1aefbddbdae3ad3d3928e464426f1.zip |
opmode: T5191: replace underscores with hyphens in generated options
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/opmode.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/python/vyos/opmode.py b/python/vyos/opmode.py index d7172a0b5..230a85541 100644 --- a/python/vyos/opmode.py +++ b/python/vyos/opmode.py @@ -209,6 +209,11 @@ def run(module): for opt in type_hints: th = type_hints[opt] + # Function argument names use underscores as separators + # but command-line options should use hyphens + # Without this, we'd get options like "--foo_bar" + opt = re.sub(r'_', '-', opt) + if _get_arg_type(th) == bool: subparser.add_argument(f"--{opt}", action='store_true') else: |