aboutsummaryrefslogtreecommitdiffstats
path: root/tools/search_arxiv.sh
blob: 7372c4d0f1ff350e03222de5a60a3037498697e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env bash
set -e

# @describe Search arXiv for a query and return the top papers.

# @env ARXIV_MAX_RESULTS=5 The max results to return.
# @option --query! The query to search for.

main() {
    encoded_query="$(jq -nr --arg q "$argc_query" '$q|@uri')"
    url="http://export.arxiv.org/api/query?search_query=all:$encoded_query&max_results=$ARXIV_MAX_RESULTS"
    curl -fsSL "$url" 
}

eval "$(argc --argc-eval "$0" "$@")"