add new option

This commit is contained in:
2021-01-09 08:42:58 +08:00
parent 3ad22a14d2
commit 493ee0f270
2 changed files with 7 additions and 1 deletions

View File

@@ -45,11 +45,15 @@ class settings:
class commandline:
def __init__(self, commandline: List[str] = None):
self._rebuildHashlist = False
self._exitAfterRebuild = False
if commandline is not None:
self.parse(commandline)
def parse(self, commandline: List[str]):
cml = getopt(commandline, '', ['rebuild-hashlist'])
cml = getopt(commandline, '', [
'rebuild-hashlist', 'exit-after-rebuild'])
for i in cml[0]:
if i[0] == '--rebuild-hashlist':
self._rebuildHashlist = True
if i[0] == '--exit-after-rebuild':
self._exitAfterRebuild = True

View File

@@ -60,6 +60,8 @@ class RSSCheckerThread(Thread):
rss.title, rss.url, updateTime, rss.hashList, p.ttl)
except:
print(format_exc())
if self._main._commandLine._rebuildHashlist and self._main._commandLine._exitAfterRebuild:
exit(0)
self._main._commandLine._rebuildHashlist = False
def __init__(self, m):