用于高能物理参考的命令行辅助工具。
heprefs的Python项目详细描述
高能物理参考文献:cli
你认为命令太长了吗?只需通过编辑.zshrc
来配置shell;例如,
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 }
(或见下文)您只需键入xget 1802.07720 1708.00283
等即可下载多个PDF!
设置
对于python 2或3。
安装
$ 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
或者您可以通过安装特定版本,例如
$ 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
升级
$ pip install git+https://github.com/misho104/heprefs.git --upgrade
卸载
$ pip uninstall heprefs
使用量
用浏览器打开摘要页
$ 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'
通过浏览器打开PDF,或下载PDF文件
CD或InspireHep查询可能找不到PDF。
$ 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
显示信息
$ heprefs authors 1505.02996
$ heprefs first_author hep-th/9711200
$ heprefs title 10.1038/nphys3005
$ heprefs short_info ATLAS-CONF-2017-018
高级使用
指定搜索引擎
有三种类型:arxiv、inspirehep和cds。它们是自动猜测的,但您可以指定类型:
$ 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
命令太长?
在你的.zshrc
,.bashrc
等…
alias xa='heprefs abs' alias xx='heprefs pdf' alias xget='heprefs get'
或者如果要处理多个参数,
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 }
(您可能也想使用Inspire Search,但这不是本软件的功能。)
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 & }
现在您可以调用
$ xa 1505.02996 $ xget 9709356$ fin a Giudice and Masiero $ fin bb hep-th/9711200 $ insp relaxion