[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>
This commit is contained in:
Simon Sawicki
2023-03-03 22:36:11 +05:30
committed by pukkandan
parent 29cb20bd56
commit 77df20f14c
6 changed files with 150 additions and 43 deletions

View File

@@ -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',