Created
June 7, 2024 03:50
-
-
Save donpdonp/348f2e9125e70fd2550cf5783f299f30 to your computer and use it in GitHub Desktop.
mullvad cli wrapper in uiua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
donp@carbon ~ $ vpn | |
┌╴? /opt/bin/vpn:3:13 | |
│╴╴╴Cli╶╶╶ | |
├╴{"mullvad" "status"} | |
└╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴ | |
"" | |
"Connected to us-lax-wg-404 in Los Angeles, CA, USA\n" | |
donp@carbon ~ $ vpn set se | |
┌╴? /opt/bin/vpn:3:13 | |
│╴╴╴Cli╶╶╶ | |
├╴{"mullvad" "relay" "set" "location" "se"} | |
└╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴ | |
"" | |
"Relay constraints updated\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env uiua | |
Cli ← &runc ? | |
DropFirst ← ↙ (- 1 ⧻) . ↻ 1 | |
Params ← DropFirst &args | |
Argdefault ← °□ ⊡ =0 ⧻ Params {Params {"status"}} | |
Cmd ← ⊂ {"mullvad"} | |
Status ← Cmd {"status"} | |
Connect ← Cmd {"connect"} | |
Disconnect ← Cmd {"disconnect"} | |
Relay ← |1 Cmd ⊂ {"relay" "set" "location"} | |
Cmdlist ← {"status" "on" "off" "set"} | |
Bashline ← ⟨Status|Connect|Disconnect|Relay⟩ ⊗ ⊢ Argdefault Cmdlist DropFirst Argdefault | |
◌ Cli Bashline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment