Take file as argument

This commit is contained in:
Louis Elkner-Alfaro 2024-10-24 11:51:57 -07:00
parent 466585fe88
commit 5027c4ce46

View file

@ -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)