From 5027c4ce467df34e875eac5f6430e46fec90548f Mon Sep 17 00:00:00 2001 From: Louis Elkner-Alfaro Date: Thu, 24 Oct 2024 11:51:57 -0700 Subject: [PATCH] Take file as argument --- generate_issues.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/generate_issues.py b/generate_issues.py index 937abda..1f9f41a 100644 --- a/generate_issues.py +++ b/generate_issues.py @@ -1,8 +1,9 @@ -import os import csv -import re from dotenv import load_dotenv +import os +import re import requests +import sys load_dotenv() FORGEJO_API_TOKEN = os.getenv("FORGEJO_API_TOKEN") @@ -70,9 +71,6 @@ def parse_notes_section(notes): def parse_harvest_csv(file=None): global issues_and_urls - if file is None: - file = prompt_for_file(file) - print('Beginning parsing for issues') with open(file, 'r') as f: @@ -100,5 +98,12 @@ def parse_harvest_csv(file=None): row_count += 1 if __name__ == "__main__": - parse_harvest_csv() + try: + file_path = sys.argv[1] + except Exception as e: + print("No file provided, exitting") + quit() + if file_path: + check_for_file(file_path) + parse_harvest_csv(file_path)