forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharxiv.sh
executable file
·43 lines (40 loc) · 1.34 KB
/
arxiv.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Search in arXiv
# @raycast.mode silent
#
# Optional parameters:
# @raycast.packageName Web Searches
# @raycast.icon images/arxiv.png
# @raycast.argument1 { "type": "text", "placeholder": "Query", "percentEncoded": true }
# @raycast.argument2 { "type": "text", "placeholder": "Field (default: all)", "optional": true, "percentEncoded": true }
# @raycast.author Marco Varisco
# @raycast.authorURL https://github.com/mava
archive="" # Leave empty to search in all archives, or use one of the available archives:
# physics astro-ph cond-mat gr-qc hep-ex hep-lat hep-ph hep-th math-ph nlin nucl-ex nucl-th quant-ph
# cs econ eess math q-bio q-fin stat
# For example, uncomment the following line to search only in archive math:
# archive="math"
case $(tr "[:upper:]" "[:lower:]" <<< $2) in
""|"al"|"all")
searchtype="all"
;;
"ti"|"tit"|"titl"|"title"|"titles")
searchtype="title"
;;
"au"|"aut"|"auth"|"autho"|"author"|"authors")
searchtype="author"
;;
"ab"|"abs"|"abst"|"abstr"|"abstra"|"abstrac"|"abstract"|"abstracts")
searchtype="abstract"
;;
"co"|"com"|"comm"|"comme"|"commen"|"comment"|"comments")
searchtype="comments"
;;
*)
searchtype=$2
;;
esac
open "https://arxiv.org/search/$archive?query=$1&searchtype=$searchtype"