forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugins.sh
More file actions
executable file
·37 lines (33 loc) · 1.48 KB
/
plugins.sh
File metadata and controls
executable file
·37 lines (33 loc) · 1.48 KB
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
BASE_URL="https://plugins.jetbrains.com"
SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
STUDIO_DIR=`ls -d $SCRIPT_PATH/../studio/*`
STUDIO_BUILD=`cat "$STUDIO_DIR"/android-studio/product-info.json \
| jq -r '.productCode + "-" + .buildNumber'`
if [[ -z "$1" ]] || [[ "$1" == "help" ]]; then
echo -n \
"usage: plugins <command> [<args>]
A CLI for JB's plugin marketplace that supports querying and installing plugins that support the current version of Studio.
Commands:
help Display this help text
ls [<query>] Query plugin marketplace by plugin name for plugin ids supporting the current version of Studio
install <id> Download and install plugins by plugin id
"
elif [[ $1 == "ls" ]]; then
QUERY="$2"
curl -s "$BASE_URL/plugins/list?build=$STUDIO_BUILD" \
| egrep -o "<name>[^<]+</name><id>[a-zA-Z0-9\.]+</id>" \
| sed 's/<id>/id: /g' \
| sed 's/<\/id>//g' \
| sed 's/<name>/name: /g' \
| sed 's/<\/name>/>/g' \
| grep -i "$QUERY" \
| column -t -s\>
elif [[ $1 == "install" ]]; then
ID="$2"
wget "$BASE_URL/pluginManager?action=download&id=$ID&build=$STUDIO_BUILD" -O ~/.dustinlam_plugins_download \
&& unzip -od "$STUDIO_DIR/android-studio/plugins" ~/.dustinlam_plugins_download
elif [[ $1 == "help" ]]; then
echo "ls [query]"
echo "install [id]"
fi