Skip to content

Commit

Permalink
Update export.R
Browse files Browse the repository at this point in the history
Improved output readability of export_ris function by replacing print with cat for final mapping display.
  • Loading branch information
TNRiley authored May 24, 2024
1 parent eb0def5 commit 82ec4ea
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions R/export.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,19 @@ export_ris <- function(x, filename = "output.ris", user_mapping = NULL) {
}
}

# Print the final mapping and ask the user if they want to proceed
print(default_mapping)
proceed <- readline("Do you want to proceed with this mapping? (yes/no): ")

if (tolower(proceed) == "yes") {
# Currently, write_refs does not accept tibbles, thus converted
write_refs(as.data.frame(x), file = filename)
} else {
message("Export cancelled. Please modify your user_mapping argument and try again.")
}
# Print the final mapping and ask the user if they want to proceed
cat("\nFinal Mapping:\n")
for (field in names(default_mapping)) {
cat(field, ":", default_mapping[[field]], "\n")
}

proceed <- readline("Do you want to proceed with this mapping? (yes/no): ")

if (tolower(proceed) == "yes") {
# Currently, write_refs does not accept tibbles, thus converted
write_refs(as.data.frame(citations), file = filename)
} else {
message("Export cancelled. Please modify your user_mapping argument and try again.")
}


Expand Down

0 comments on commit 82ec4ea

Please sign in to comment.