[core] Implement --color flag (#6904)

Authored by: Grub4K
This commit is contained in:
Simon Sawicki
2023-05-24 20:35:07 +02:00
committed by GitHub
parent 7aeda6cc9e
commit 8417f26b8a
5 changed files with 66 additions and 12 deletions

View File

@@ -436,6 +436,10 @@ def validate_options(opts):
elif ed and proto == 'default':
default_downloader = ed.get_basename()
for policy in opts.color.values():
if policy not in ('always', 'auto', 'no_color', 'never'):
raise ValueError(f'"{policy}" is not a valid color policy')
warnings, deprecation_warnings = [], []
# Common mistake: -f best
@@ -894,7 +898,7 @@ def parse_options(argv=None):
'playlist_items': opts.playlist_items,
'xattr_set_filesize': opts.xattr_set_filesize,
'match_filter': opts.match_filter,
'no_color': opts.no_color,
'color': opts.color,
'ffmpeg_location': opts.ffmpeg_location,
'hls_prefer_native': opts.hls_prefer_native,
'hls_use_mpegts': opts.hls_use_mpegts,