do not clear output by default
This commit is contained in:
parent
4ceb1ef9e3
commit
fdd25f3de6
@ -15,13 +15,14 @@ def config_file() -> Optional[str]:
|
||||
|
||||
|
||||
class Configuration:
|
||||
db = "spip"
|
||||
db_host = "localhost"
|
||||
db_user = "spip"
|
||||
db_pass = "password"
|
||||
output_dir = "output"
|
||||
default_export_max = 1000
|
||||
data_dir = "data"
|
||||
db: str = "spip"
|
||||
db_host: str = "localhost"
|
||||
db_user: str = "spip"
|
||||
db_pass: str = "password"
|
||||
output_dir: str = "output"
|
||||
default_export_max: int = 1000
|
||||
data_dir: str = "data"
|
||||
clear_output: bool = False
|
||||
|
||||
def __init__(self, config_file: Optional[str] = None) -> None:
|
||||
if config_file is not None:
|
||||
@ -39,6 +40,8 @@ class Configuration:
|
||||
self.default_export_max = config["default_export_max"]
|
||||
if "data_dir" in config:
|
||||
self.data_dir = config["data_dir"]
|
||||
if "clear_output" in config:
|
||||
self.clear_output = config["clear_output"]
|
||||
|
||||
|
||||
config = Configuration(config_file())
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!python
|
||||
# pyright: strict
|
||||
from os import makedirs, mkdir
|
||||
from os import makedirs
|
||||
from os.path import expanduser
|
||||
from shutil import copyfile, rmtree
|
||||
from sys import argv
|
||||
@ -58,9 +58,10 @@ if __name__ == "__main__": # Only if script is directly executed
|
||||
else:
|
||||
toexport = config.default_export_max
|
||||
|
||||
if config.clear_output:
|
||||
# Clear the output dir & create a new
|
||||
rmtree(config.output_dir, True)
|
||||
mkdir(config.output_dir)
|
||||
makedirs(config.output_dir, exist_ok=True)
|
||||
|
||||
# Articles that contains unknown chars
|
||||
unknown_chars_articles: list[Article] = []
|
||||
|
Loading…
Reference in New Issue
Block a user