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):
|
def extract_save(pdf_file, dest):
|
||||||
"""Extract charge and locataire for pdf_file and put xlsx file in dest"""
|
"""Extract charge and locataire for pdf_file and put xlsx file in dest"""
|
||||||
pdf_file = Path(pdf_file)
|
pdf_file = Path(pdf_file)
|
||||||
xls_charge = dest / f"{pdf_file.stem.replace(' ', '_')}_charge.xlsx"
|
xls_charge = Path(dest) / f"{pdf_file.stem.replace(' ', '_')}_charge.xlsx"
|
||||||
xls_locataire = dest / f"{pdf_file.stem.replace(' ', '_')}_locataire.xlsx"
|
xls_locataire = Path(dest) / f"{pdf_file.stem.replace(' ', '_')}_locataire.xlsx"
|
||||||
|
|
||||||
pdf = pdfplumber.open(pdf_file)
|
pdf = pdfplumber.open(pdf_file)
|
||||||
extract_from_pdf(pdf, xls_charge, xls_locataire)
|
extract_from_pdf(pdf, xls_charge, xls_locataire)
|
||||||
|
@ -17,11 +17,13 @@ def extract():
|
|||||||
|
|
||||||
@extract.command()
|
@extract.command()
|
||||||
@click.argument("pdf_file", required=1)
|
@click.argument("pdf_file", required=1)
|
||||||
def on(pdf_file):
|
@click.option("--dest", help="Où mettre les fichiers produits", default="")
|
||||||
|
def on(pdf_file, dest):
|
||||||
|
if not dest:
|
||||||
pdf_path = Path(pdf_file)
|
pdf_path = Path(pdf_file)
|
||||||
pdf_filename = pdf_path.name
|
dest = pdf_path.parent
|
||||||
pdf_path = pdf_path.parent
|
|
||||||
extract_save(pdf_file, pdf_path)
|
extract_save(pdf_file, dest)
|
||||||
|
|
||||||
|
|
||||||
@extract.command()
|
@extract.command()
|
||||||
|
Loading…
Reference in New Issue
Block a user