summaryrefslogtreecommitdiffstats
path: root/current
diff options
context:
space:
mode:
authorRaghavendra D Prabhu <[email protected]>2011-07-16 23:11:17 +0530
committerRaghavendra D Prabhu <[email protected]>2011-07-16 23:11:17 +0530
commit56d848c248199f02521e293f0568dbeac5185097 (patch)
tree430b777dfe67dc31647f0d1cf186a98017a49278 /current
parent806e6210978606d89e3af70eb10d90351b3ea488 (diff)
downloadScripts-56d848c248199f02521e293f0568dbeac5185097.tar.gz
Scripts-56d848c248199f02521e293f0568dbeac5185097.tar.bz2
Scripts-56d848c248199f02521e293f0568dbeac5185097.zip
Scripts update
Diffstat (limited to 'current')
-rwxr-xr-xcurrent13
1 files changed, 6 insertions, 7 deletions
diff --git a/current b/current
index 3811d29..4d21bd3 100755
--- a/current
+++ b/current
@@ -1,17 +1,16 @@
#!/bin/zsh
+[[ -z $1 ]] && exit 1
+typeset -A choice
+choice=(current ~/.current url ~/urls all "$HOME/.current $HOME/urls")
setopt shwordsplit
-isurl () {
- curl -I -s "$url" &>/dev/null || return 1
- return 0
- }
export yprofile="current"
while :;do
- object=$(paste ~/.current ~/note | tac | awk 'NF>0 { print $0 }' | ${DMENU} )
+ object=$(tac $=choice[$1] | awk 'NF>0 { print $0 }' | ${DMENU} )
[[ -z $object ]] && break
object=${(Q)object}
- if isurl $object;then firefox -new-tab $object; continue ;fi
+ URL=$(perl -MRegexp::Common=URI -lne 'm{$RE{URI}{HTTP}{-scheme => qr/https?/}{-keep}} && print $1' <<< $object)
+ if isurl $URL;then firefox -new-tab $URL; continue ;fi
xclip -i <<< "$object"
if =$object;then $object &!;fi
done