Last active
August 29, 2015 14:11
-
-
Save vifon/30c6e4a9edeab6832fd4 to your computer and use it in GitHub Desktop.
Simple wicd-cli wrapper
This file contains 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
#!/bin/zsh | |
zebra() | |
{ | |
local r=0 | |
while IFS='' read -r line; do | |
r=$((!r)) | |
(( r )) && print -n '\e[1;34m' | |
print $line | |
(( r )) && print -n '\e[0m' | |
done | |
} | |
typeset -A cmd | |
typeset -r EOF=$'\x4' | |
typeset -r CTRL_L=$'\xC' | |
cmd[s]="wicd-cli -y -S" | |
if (( $+commands[colout] )); then | |
cmd[l]="wicd-cli -y -l | colout '^\\d.*' rainbow" | |
else | |
cmd[l]="wicd-cli -y -l | zebra" | |
fi | |
cmd[x]="wicd-cli -y -x" | |
cmd[$CTRL_L]="clear" | |
cmd[$EOF]="exit" | |
cmd[q]="exit" | |
for i in {0..9}; do | |
cmd[$i]="wicd-cli -y -c -n $i" | |
done | |
while print -n "> " && read -s -k; do | |
print ${cmd[$REPLY]%%|*} | |
eval "$cmd[$REPLY]" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment