fix nvtake name=version corrupted the oldver file

fixes #272.
This commit is contained in:
lilydjwg 2024-05-24 15:04:49 +08:00
parent 2800f392d9
commit c66ca7f2bc
1 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# vim: se sw=2:
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
# Copyright (c) 2013-2024 lilydjwg <lilydjwg@gmail.com>, et al.
import sys
import argparse
@ -10,6 +10,7 @@ import json
import os.path
from . import core
from .util import RichResult
logger = structlog.get_logger(logger_name=__name__)
@ -44,10 +45,11 @@ def take() -> None:
if args.all:
oldvers.update(newvers)
else:
name: str
for name in args.names:
if "=" in name:
name, newver = name.split("=")
oldvers[name] = newver
oldvers[name] = RichResult(version=newver)
else:
try:
oldvers[name] = newvers[name]