mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
Handle changes involve None versions
This commit is contained in:
parent
689c69ef60
commit
35f28056b6
1 changed files with 18 additions and 1 deletions
|
@ -120,13 +120,24 @@ def cmp() -> None:
|
|||
version = sort_version_keys[args.sort]
|
||||
|
||||
if version(oldver) > version(newver): # type: ignore
|
||||
diff['delta'] = 'old'
|
||||
if args.newer:
|
||||
continue # don't store this diff
|
||||
diff['delta'] = 'old'
|
||||
else:
|
||||
diff['delta'] = 'new'
|
||||
|
||||
differences.append(diff)
|
||||
|
||||
elif oldver is None:
|
||||
if args.newer:
|
||||
continue # don't store this diff
|
||||
diff['delta'] = 'added'
|
||||
differences.append(diff)
|
||||
|
||||
elif newver is None:
|
||||
diff['delta'] = 'gone'
|
||||
differences.append(diff)
|
||||
|
||||
elif args.all:
|
||||
differences.append(diff)
|
||||
|
||||
|
@ -152,6 +163,12 @@ def cmp() -> None:
|
|||
elif delta == 'old':
|
||||
arrow = f'{c.red}<-{c.normal}'
|
||||
oldc = c.red
|
||||
if delta == 'added':
|
||||
arrow = '++'
|
||||
oldc = c.red
|
||||
elif delta == 'gone':
|
||||
arrow = f'{c.red}--{c.normal}'
|
||||
oldc = c.green
|
||||
else:
|
||||
arrow = '=='
|
||||
oldc = c.green
|
||||
|
|
Loading…
Add table
Reference in a new issue