From 77df20f14cc9ed41dfe3a1fe2d77fd27f5365a94 Mon Sep 17 00:00:00 2001 From: Simon Sawicki Date: Fri, 3 Mar 2023 22:36:11 +0530 Subject: [update] Add option `--update-to`, including to nightly (#6220) * By default, stable will only update to stable, and nightly to nightly Authored by: Grub4K, bashonly, pukkandan Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com> --- yt_dlp/options.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'yt_dlp/options.py') diff --git a/yt_dlp/options.py b/yt_dlp/options.py index fd60ff55f..b81e14966 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -20,7 +20,7 @@ from .postprocessor import ( SponsorBlockPP, ) from .postprocessor.modify_chapters import DEFAULT_SPONSORBLOCK_CHAPTER_TITLE -from .update import detect_variant, is_non_updateable +from .update import UPDATE_SOURCES, detect_variant, is_non_updateable from .utils import ( OUTTMPL_TYPES, POSTPROCESS_WHEN, @@ -36,7 +36,7 @@ from .utils import ( remove_end, write_string, ) -from .version import __version__ +from .version import CHANNEL, __version__ def parseOpts(overrideArguments=None, ignore_config_files='if_override'): @@ -326,11 +326,18 @@ def create_parser(): action='store_true', dest='update_self', help=format_field( is_non_updateable(), None, 'Check if updates are available. %s', - default='Update this program to the latest version')) + default=f'Update this program to the latest {CHANNEL} version')) general.add_option( '--no-update', action='store_false', dest='update_self', help='Do not check for updates (default)') + general.add_option( + '--update-to', + action='store', dest='update_self', metavar='[CHANNEL]@[TAG]', + help=( + 'Upgrade/downgrade to a specific version. CHANNEL and TAG defaults to ' + f'"{CHANNEL}" and "latest" respectively if ommited; See "UPDATE" for details. ' + f'Supported channels: {", ".join(UPDATE_SOURCES)}')) general.add_option( '-i', '--ignore-errors', action='store_true', dest='ignoreerrors', -- cgit v1.2.3