Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions caltechdata_api/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ def upload_supporting_file(record_id=None):
filepaths = []
file_link = ""
file_links = []
idx = 0
while True:
choice = get_user_input(
"Do you want to upload or link data files? (upload/link/n): "
Expand Down Expand Up @@ -402,14 +403,28 @@ def upload_supporting_file(record_id=None):
files = [
f for f in os.listdir() if not f.endswith(".json") and os.path.isfile(f)
]
print("\n".join(files))
idx+=1
print((f"{idx}/ \n").join(files))
while True:
filename = get_user_input(
"Enter the filename to upload as a supporting file (or 'n' to finish): "
"Enter the filename to upload as a supporting file (or '*' to get all files currently in this directory, or the index number of the file as displayed followed by a /, otherwise 'n' to finish): "
)
if filename == "n":
if filename == "*":
for files_name in files:
filepath = os.path.abspath(files_name)
filepaths.append(filepath)
print("All files added successfully")
elif filename == "n":
break
if filename in files:
elif (not len(filename) == 0) and (filename[len(filename) - 1] == '/'):
try:
files_name = files[int(filename[0])-1]
filepath = os.path.abspath(files_name)
filepaths.append(filepath)
print("File added successfully")
except ValueError:
continue
elif filename in files:
file_size = os.path.getsize(filename)
if file_size > 1024 * 1024 * 1024:
print(
Expand All @@ -420,6 +435,7 @@ def upload_supporting_file(record_id=None):
else:
filepath = os.path.abspath(filename)
filepaths.append(filepath)
print("File added successfully")
else:
print(
f"Error: File '{filename}' not found. Please enter a valid filename."
Expand Down
15 changes: 13 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@
},
"email": "[email protected]",
"@id": "https://orcid.org/0009-0003-5640-6691"
}
},
{
"@type": "Person",
"givenName": "Kshemaahna",
"familyName": "Nagi",
"affiliation": {
"@type": "Organization",
"name": "Caltech"
},
"email": "[email protected]",
"@id": "https://orcid.org/0009-0002-8113-3763"
},
],
"developmentStatus": "active",
"downloadUrl": "https://github.com/caltechlibrary/caltechdata_api/archive/1.9.1.zip",
Expand Down Expand Up @@ -84,4 +95,4 @@
},
"programmingLanguage": "Python",
"identifier": "10.22002/3gdk4-j5504"
}
}
Loading