implement the "exit" option for the "skip" config-key

This commit is contained in:
Mike Fährmann
2017-05-05 15:49:58 +02:00
parent cfbf79d788
commit ef90a2de2f
2 changed files with 8 additions and 5 deletions

View File

@@ -145,8 +145,10 @@ class PathFormat():
skipmode = extractor.config("skip", True)
if skipmode == "abort":
self.exists = self._exists_abort
elif skipmode == "exit":
self.exists = self._exists_exit
elif not skipmode:
self.exists = self._exists_false
self.exists = lambda: False
def open(self):
"""Open file to 'realpath' and return a corresponding file object"""
@@ -195,8 +197,9 @@ class PathFormat():
raise exception.StopExtraction()
return False
@staticmethod
def _exists_false():
def _exists_exit(self):
if self.has_extension and os.path.exists(self.realpath):
exit()
return False
@staticmethod