forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopensecrets.sh
executable file
·37 lines (35 loc) · 1000 Bytes
/
opensecrets.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
#!/bin/bash
#
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Search OpenSecrets.org
# @raycast.mode silent
#
# Optional parameters:
# @raycast.packageName Web Searches
# @raycast.icon images/opensecrets.png
# @raycast.argument1 { "type": "text", "placeholder": "Query", "percentEncoded": true }
# @raycast.argument2 { "type": "text", "placeholder": "Type (default: donor)", "optional": true, "percentEncoded": true }
# @raycast.author Daniel Sieradski
# @raycast.authorURL https://github.com/selfagency
case $(tr "[:upper:]" "[:lower:]" <<<$2) in
"" | "d" | "donor" | "donors")
searchtype="donors"
;;
"p" | "pol" | "pols" | "politician" | "politicians" | "l" | "lob" | "lobbyist" | "lobbyists")
searchtype="indiv"
;;
"o" | "org" | "orgs" | "organization" | "organizations")
searchtype="orgs"
;;
"n" | "news")
searchtype="news"
;;
"s" | "site")
searchtype="site"
;;
*)
searchtype=$2
;;
esac
open "https://www.opensecrets.org/search?q=$1&type=$searchtype"