Replaces the underscores in snake_case names with hyphens: output_dir → output-dir. Hyphenated lowercase names are the norm for long command-line options, URL paths, Kubernetes resource names, npm package names and CSS classes, none of which use underscores by convention.
A common case is a Python script whose argparse options or config keys were written with underscores and now need the conventional --flag-name form, or database identifiers that have to appear in URLs.
String, one per line or inline.Result text.--dry_run
--output_dir dist
--max_workers 4--dry-run
--output-dir dist
--max-workers 4Each option name gets hyphens, and the leading -- and the values dist and 4 are kept. In argparse, --dry-run is still read as args.dry_run, so the Python side does not change.
max_workers → max-workers, address_line_2 → address-line-2.--, / or ?page=, is preserved._internal_id → internal-id.argparse and click accept --output_dir, but users expect --output-dir. Converting the option list and updating the add_argument calls keeps the attribute names (output_dir) the same.
Category codes like gift_cards or order_history stored in a table can be turned into /gift-cards and /order-history paths, which are the more common style for public URLs.
__version__, are not matched and keep their underscores.add_argument and keywords like store_true are also converted, which breaks the code. Paste only the names.No. kebab-case is for strings such as options, URLs, file names and resource names; keep Python variables in snake_case.
Kubernetes names allow lowercase letters, digits and hyphens, and that is exactly what this produces from normal snake_case input, including digit segments.