forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarp-stop.sh
executable file
·38 lines (29 loc) · 950 Bytes
/
warp-stop.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
#!/bin/bash
# Dependency: Cloudflare WARP https://developers.cloudflare.com/warp-client/setting-up/macOS
# Note: Cloudflare WARP must be installed, but CLI works properly only if GUI-client is not running
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Disconnect
# @raycast.mode compact
# Optional parameters:
# @raycast.icon images/warp.png
# @Documentation:
# @raycast.packageName WARP
# @raycast.description Disconnect from WARP
# @raycast.author Sergey Fuksman
# @raycast.authorURL https://github.com/fuksman
if ! command -v warp-cli &> /dev/null; then
echo "WARP is required (https://developers.cloudflare.com/warp-client/setting-up/macOS)";
exit 1;
fi
# Source: https://superuser.com/a/736859
function isnt_connected () {
warp-cli status | sed -n 2p | grep -qv Connected
}
if isnt_connected; then
echo "WARP is not connected"
exit 1
else
warp-cli disconnect
echo "Disconnected from WARP"
fi