forked from matryer/xbar-plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmas.1d.sh
21 lines (17 loc) · 1014 Bytes
/
mas.1d.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# <bitbar.title>Mac App Store</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>iosdeveloper</bitbar.author>
# <bitbar.author.github>iosdeveloper</bitbar.author.github>
# <bitbar.desc>Lists available updates from the Mac App Store using mas-cli (https://github.com/argon/mas). Based on brew-updates.1h.sh</bitbar.desc>
# <bitbar.image>http://i.imgur.com/yPeXDAj.png</bitbar.image>
# <bitbar.dependencies>mas</bitbar.dependencies>
# <bitbar.abouturl>https://github.com/matryer/bitbar-plugins/blob/master/System/mas.1d.sh</bitbar.abouturl>
UPDATES=$(/usr/local/bin/mas outdated);
UPDATE_COUNT=$(echo "$UPDATES" | grep -c '[^[:space:]]');
echo "↑$UPDATE_COUNT | dropdown=false"
echo "---";
if [ -n "$UPDATES" ]; then
echo "Upgrade all | bash=/usr/local/bin/mas param1=upgrade terminal=false refresh=true"
echo "$UPDATES" | awk '{itemIdentifier = $1; $1 = ""; print $0 " | bash=/usr/local/bin/mas param1=install param2=" itemIdentifier " terminal=false refresh=true"; }'
fi