Feat: add dest to on command
This commit is contained in:
parent
b4e70f00fc
commit
572f58c0a9
@ -41,8 +41,8 @@ def extract_from_pdf(pdf, charge_dest, location_dest):
|
||||
def extract_save(pdf_file, dest):
|
||||
"""Extract charge and locataire for pdf_file and put xlsx file in dest"""
|
||||
pdf_file = Path(pdf_file)
|
||||
xls_charge = dest / f"{pdf_file.stem.replace(' ', '_')}_charge.xlsx"
|
||||
xls_locataire = dest / f"{pdf_file.stem.replace(' ', '_')}_locataire.xlsx"
|
||||
xls_charge = Path(dest) / f"{pdf_file.stem.replace(' ', '_')}_charge.xlsx"
|
||||
xls_locataire = Path(dest) / f"{pdf_file.stem.replace(' ', '_')}_locataire.xlsx"
|
||||
|
||||
pdf = pdfplumber.open(pdf_file)
|
||||
extract_from_pdf(pdf, xls_charge, xls_locataire)
|
||||
|
@ -17,11 +17,13 @@ def extract():
|
||||
|
||||
@extract.command()
|
||||
@click.argument("pdf_file", required=1)
|
||||
def on(pdf_file):
|
||||
pdf_path = Path(pdf_file)
|
||||
pdf_filename = pdf_path.name
|
||||
pdf_path = pdf_path.parent
|
||||
extract_save(pdf_file, pdf_path)
|
||||
@click.option("--dest", help="Où mettre les fichiers produits", default="")
|
||||
def on(pdf_file, dest):
|
||||
if not dest:
|
||||
pdf_path = Path(pdf_file)
|
||||
dest = pdf_path.parent
|
||||
|
||||
extract_save(pdf_file, dest)
|
||||
|
||||
|
||||
@extract.command()
|
||||
|
Loading…
Reference in New Issue
Block a user