A commandline helper tool for high-energy physics referencing.
Project description
heprefs: CLI for high-energy physics references
Do you think the commands are too long? Simply configure your shell by editing .zshrc
; for example,
function xa() { if [ $# != 0 ]; then for i in $*; do heprefs abs $i; done; fi }
function xx() { if [ $# != 0 ]; then for i in $*; do heprefs pdf $i; done; fi }
function xget() { if [ $# != 0 ]; then for i in $*; do heprefs get -o $i; done; fi }
function xsource() { if [ $# != 0 ]; then for i in $*; do heprefs source -u $i; done; fi }
(or see below) and you will just type xget 1802.07720 1708.00283
etc. to download multiple PDFs!
Set up
For Python 2 or 3.
Install
$ pip install git+https://github.com/misho104/heprefs.git
Collecting git+https://github.com/misho104/heprefs.git
Cloning https://github.com/misho104/heprefs.git to /private/tmp/pip-wjd8srsu-build
...
Successfully installed arxiv-0.1.1 click-6.7 feedparser-5.2.1 heprefs-0.1.0 requests-2.13.0
or you can install specific version by, e.g.,
$ pip install git+https://github.com/misho104/heprefs.git@v0.1.0 # for v0.1.0
$ pip install git+https://github.com/misho104/heprefs.git@development # for development version
Upgrade
$ pip install git+https://github.com/misho104/heprefs.git --upgrade
Uninstall
$ pip uninstall heprefs
Usage
Open abstract pages by a browser
$ heprefs abs 1505.02996 # arXiv
$ heprefs abs hep-th/9711200 # arXiv (old style)
$ heprefs abs ATLAS-CONF-2017-018 # CERN Document Server
$ heprefs abs 10.1038/nphys3005 # DOI (inspireHEP)
$ heprefs abs "fin a Ellis" # inspireHEP (first result is only shown)
$ heprefs abs 9709356 # equivalent to 'hep-ph/9709356'
Open PDF by browser, or Download PDF file
PDF may not be found for CDS or inspireHEP queries.
$ heprefs pdf 1505.02996 # arXiv
$ heprefs pdf ATLAS-CONF-2017-018 # CERN Document Server
$ heprefs get 10.1038/nphys3005 # DOI (inspireHEP)
$ heprefs get "fin a Ellis" # inspireHEP (first result)
$ heprefs get -o "fin a Giudice" # open the PDF file
Show information
$ heprefs authors 1505.02996
$ heprefs first_author hep-th/9711200
$ heprefs title 10.1038/nphys3005
$ heprefs short_info ATLAS-CONF-2017-018
Advanced usage
Specify search engine
There are three types: arXiv, inspireHEP, and CDS. They are automatically guessed, but you can specify a type:
$ heprefs abs -t arxiv 1505.02996 # arXiv
$ heprefs abs -t cds "top asymmetry" # CDS
$ heprefs abs -t ins "top asymmetry" # inspireHEP
$ heprefs abs ATLAS-CONF-2017-018 # guessed as CDS search
$ heprefs abs -t ins ATLAS-CONF-2017-018 # forced to use inspireHEP
Commands are too long?
In your .zshrc
, .bashrc
, etc...
alias xa='heprefs abs'
alias xx='heprefs pdf'
alias xget='heprefs get'
or if you want to handle multiple arguments,
function xa() { if [ $# != 0 ]; then for i in $*; do heprefs abs $i; done; fi }
function xx() { if [ $# != 0 ]; then for i in $*; do heprefs pdf $i; done; fi }
function xget() { if [ $# != 0 ]; then for i in $*; do heprefs get -o $i; done; fi }
function xsource() { if [ $# != 0 ]; then for i in $*; do heprefs source -u $i; done; fi }
(You may want to use inspire search as well, though this is not a feature of this software.)
function browser() {
google-chrome $* & # on Linux
# open $* -a Google\ Chrome # on macOS
}
function fin() {
local query; if [ $# != 0 ]; then; for i in $*; do; query="$query+$i"; done; fi
query=`echo $query | sed 's/^\+//'`
browser http://inspirehep.net/search\?p=fin+$query &
}
function insp() {
local query; if [ $# != 0 ]; then; for i in $*; do; query="$query+$i"; done; fi
query=`echo $query | sed 's/^\+//'`
browser http://inspirehep.net/search\?p=$query &
}
and now you can invoke
$ xa 1505.02996
$ xget 9709356
$ fin a Giudice and Masiero
$ fin bb hep-th/9711200
$ insp relaxion
Debug command for developers
$ heprefs debug 1505.02996
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file heprefs-0.1.4.tar.gz
.
File metadata
- Download URL: heprefs-0.1.4.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.10 CPython/3.6.7 Darwin/18.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 852cc3b02f8dcdaa1ed2974a28d65107a3ea550461149a76f362f32c0bab7c0a |
|
MD5 | 75a292d680f3264f1b51a9672b65bbd8 |
|
BLAKE2b-256 | 60d57bc9b19a3fb3e1b97847113b8f98865aef17bb79da4c993979fa58a1707e |
File details
Details for the file heprefs-0.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: heprefs-0.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 32.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.10 CPython/3.6.7 Darwin/18.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1c162cabc9c6a54cc72f8bdb840560daab67305e398a40fbdab25115f95b4a0 |
|
MD5 | 65e0f6c6db198af40ab07f84c659a4fb |
|
BLAKE2b-256 | 35abc86af86a30585c187fe4fa1f87fd254605682b3068f87c210f3248149d21 |