[options] add '--restrict-filenames' & '--windows-filenames'

This commit is contained in:
Mike Fährmann
2026-02-05 09:30:58 +01:00
parent 09fbb3a594
commit df8aaa7e22
2 changed files with 17 additions and 0 deletions

View File

@@ -24,6 +24,10 @@
('/O' for "original" filenames)
-d, --destination PATH Target location for file downloads
-D, --directory PATH Exact location for file downloads
--restrict-filenames VALUE Replace restricted filename characters with
underscores. One of 'windows', 'unix', 'ascii',
'ascii+', or a custom set of characters
--windows-filenames Force filenames to be Windows-compatible
-X, --extractors PATH Load external extractors from PATH
--clear-cache MODULE Delete cached login sessions, cookies, etc. for
MODULE (ALL to delete everything)

View File

@@ -268,6 +268,19 @@ def build_parser():
dest="directory", metavar="PATH",
help="Exact location for file downloads",
)
general.add_argument(
"--restrict-filenames",
dest="path-restrict", metavar="VALUE", action=ConfigAction,
help=("Replace restricted filename characters with underscores. "
"One of 'windows', 'unix', 'ascii', 'ascii+', "
"or a custom set of characters"),
)
general.add_argument(
"--windows-filenames",
dest="path-restrict", nargs=0, action=ConfigConstAction,
const="windows",
help="Force filenames to be Windows-compatible",
)
general.add_argument(
"-X", "--extractors",
dest="extractor_sources", metavar="PATH", action="append",