Add version command line

This commit is contained in:
2024-09-16 13:39:50 +08:00
parent 75e6d4bd39
commit 4e5342fc83
2 changed files with 27 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ class OptAction(IntEnum):
RESTORE = 1
LIST = 2
LIST_LEVELDB_KEY = 3
VERSION = 4
@staticmethod
def from_str(v: str) -> IntEnum:
@@ -28,6 +29,8 @@ class OptAction(IntEnum):
return OptAction.LIST
elif t == 'list_leveldb_key':
return OptAction.LIST_LEVELDB_KEY
elif t == "version":
return OptAction.VERSION
else:
raise TypeError('Must be str.')
@@ -59,7 +62,7 @@ class Opts:
re = OptAction.from_str(cm[0])
if re is not None:
self.action = re
if re == OptAction.LIST:
if re == OptAction.LIST or re == OptAction.VERSION:
return
elif re == OptAction.LIST_LEVELDB_KEY:
if len(cm) == 1: