Skip to content

Commit 7f114e6

Browse files
Update cli.py
1 parent 14357dc commit 7f114e6

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

caltechdata_api/cli.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,11 @@ def get_funding_details():
186186
"funderIdentifierType": "ROR",
187187
}
188188

189+
189190
# Add profile handling functions
190191
def save_profile():
191192
profile_file = os.path.join(caltechdata_directory, "profile.json")
192-
193+
193194
# Get ORCID
194195
while True:
195196
orcid = get_user_input("Enter your ORCID identifier: ")
@@ -210,15 +211,16 @@ def save_profile():
210211
"orcid": orcid,
211212
"family_name": family_name,
212213
"given_name": given_name,
213-
"funding_references": funding_references
214+
"funding_references": funding_references,
214215
}
215216

216217
with open(profile_file, "w") as f:
217218
json.dump(profile_data, f, indent=2)
218-
219+
219220
print("Profile saved successfully!")
220221
return profile_data
221222

223+
222224
def load_profile():
223225
profile_file = os.path.join(caltechdata_directory, "profile.json")
224226
try:
@@ -227,16 +229,18 @@ def load_profile():
227229
except FileNotFoundError:
228230
return None
229231

232+
230233
def get_or_create_profile():
231234
profile = load_profile()
232235
if profile:
233236
use_saved = input("Use saved profile? (y/n): ").lower()
234-
if use_saved == 'y':
237+
if use_saved == "y":
235238
return profile
236-
239+
237240
print("Creating new profile...")
238241
return save_profile()
239242

243+
240244
def parse_arguments():
241245
welcome_message()
242246
args = {}
@@ -467,7 +471,7 @@ def main():
467471
choice = get_user_input(
468472
"What would you like to do? (create/edit/profile/exit): "
469473
).lower()
470-
474+
471475
if choice == "create":
472476
create_record(production)
473477
elif choice == "edit":
@@ -477,8 +481,10 @@ def main():
477481
elif choice == "exit":
478482
break
479483
else:
480-
print("Invalid choice. Please enter 'create', 'edit', 'profile', or 'exit'.")
481-
484+
print(
485+
"Invalid choice. Please enter 'create', 'edit', 'profile', or 'exit'."
486+
)
487+
482488

483489
def create_record(production):
484490
token = get_or_set_token(production)

0 commit comments

Comments
 (0)