Open mjpost opened 6 years ago
Actually the semantics is consistent among all commands that operate on the DB (search, open, edit, download, delete
) and are all implemented in the same way (arxiv is a bit different). E.g. you can do bibsearch search
and it will repeat the last search. open
is a bit special in that it requires that the search returns only one entry, but the rest (edit
included!) do not pose any additional restrictions.
I do not see the advantage in limiting the mode of operation for open
and edit
, neither in terms of user experience (the commands without arguments already work) nor in terms of code quality/clarity.
No defined opinion about the -e
and -o
flags for search. I don't think I would use then, but I don't have any strong feelings against them.
Oh, I see now that you changed the code and edit and open have their own search functions. Couldn't the indexing logic be included in BibDB.search()
. We can use the heuristic that if the query is just a number, then an index in the previous search is meant.
The semantics of
open
andedit
are a bit strange internally. You either open something from the cache, or search for something new, and open / edit it if the search returns only one result. I suggest instead thatopen
andedit
work only on the cache. If you want to open or edit something, you first search for it, then callopen
oredit
with the indexed result.We could also add
-e
(edit) and-o
(open) flags to "search", which would edit / open the results iff len(results) == 1.