Allow changing of entry key when clash is detected during addition
kaustubhmote opened this issue · 4 comments
Currently, if a duplicate key is detected (when an entry is being added via a doi), the addition is simply aborted, and the add
command needs to be re-invoked. This is a bit cumbersome. I think a simple prompt allowing the user to retry with a different key (or abort the attempt) will be a better way to do this. I have implemented this in the branch key-clash
in my fork. Will be happy to do a PR again if you are OK with this change.
Thanks @kaustubhmote for the suggestion!
I'm no so sure that this is a good idea. First, interactive prompts are quite hard to use in scripts compared to passing options and arguments. I would say that they are not the most CLI friendly. The citation editor that is automatically opened, and the pasting from the clipboard, is my attempt to make adding new entries as fast and easy as possible. In my experience, key clashes are quite rare, so I prefer not to add more interactivity to support such edge cases.
Second, the key validation also happens in the edit
command, and I prefer to keep a consistent behaviour. It is possible to add another prompt there, and open the editor again, but it looks like an over complicated solution compared to aborting and asking the user to run edit
again.
NB, I plan to have all of bibo's features supported in a non interactive way. A --bib
option for the add
command that takes a path to a .bib
file with the raw entry should do, but that's for a separate issue...
This sounds like a reasonable approach to me. Please feel free to close this issue.
Hope it doesn't discourage you from contributing. Hearing other people voices means a lot to me and I believe it's very important for this project. Would love to hear your opinions / issues / PRs on any aspect of bibo!
Absolutely, no problem at all! This library does solve some of my usual problems in a quick way (without databases and unnecessary GUIs). It will be nice to see it develop further.