perrette / papers

Command-line tool to manage bibliography (pdfs + bibtex)
MIT License
142 stars 22 forks source link

Add straightforward version printing to stdio. #41

Closed boyanpenkov closed 1 year ago

boyanpenkov commented 1 year ago

This adds a tiny convenience function, so that

papers status --version

will show you the version of the currently installed papers you have, so that you can figure out if papers in $PATH is what you think it is.

boyanpenkov commented 1 year ago

Confirming all tests pass, but only have tested on linux.

perrette commented 1 year ago

Good point. As a general comment and before seeing the code, I'd argue it would be more useful or usual to have it at the root level papers --version. Additionally, version number could be added to the header during status printing.

boyanpenkov commented 1 year ago

set and set.

perrette commented 1 year ago

Excellent. I'll take another look this evening (CET Berlin/Italy). First impression:

boyanpenkov commented 1 year ago

Excellent. I'll take another look this evening (CET Berlin/Italy). First impression:

* one liner `print(papers.__version__)` would work too

Done.

* might need an `parser.exit(0)` to end right after printing with `papers --version`

I guess, if you want to, since it's meant to be human-readable for stdio, I find the help info useful. If someone starts calling this externally and wants only the string, we can do this then?

* instead of `statuscmd()`, it would be tidier IMO to write the print inside the `Config.status()` method. For example, write it right in the header as `papers configuration (global) v2.3.1`, or possibly as footer after the last line. Possibly simply `v2.3.1`. I'd need to see it to get a firm impression. What do you say?

Done, I just hadn't gotten to reading config.py yet. I do think the full version string is a better idea, so then folks don't mess up 2.3.1 vs 2.3.1+yourlocalchanges.