newest goodies from dot.mkshrc
[shellsnippets/shellsnippets.git] / bash-ksh / profile-funcs
1 # Debian Bug Tracking System
2 bts() {
3         if [[ $1 = +([0-9]) ]]; then
4                 ${BROWSER:-lynx} "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$1"
5         elif [[ $1 = lp:+([0-9]) ]]; then
6                 ${BROWSER:-lynx} "https://bugs.launchpad.net/bugs/${1#lp:}"
7         else
8                 ${BROWSER:-lynx} "http://bugs.debian.org/$*"
9         fi
10 }
11 # Debian Package Tracking System, QA, buildd logs Debian, buildd logs D-Ports
12 pts() {
13         local p=${1%%_*} not_slash_bksls=$'[!/\t\n\f\r ]'
14
15         if [[ $p = src:* ]]; then
16                 ${BROWSER:-lynx} "http://packages.debian.org/source/sid/${p#src:}"
17         elif [[ $p = qa:lib${not_slash_bksls}${not_slash_bksls}* ]]; then
18                 ${BROWSER:-lynx} "http://packages.qa.debian.org/${p:3:4}/${p#qa:}.html"
19         elif [[ $p = qa:* ]]; then
20                 ${BROWSER:-lynx} "http://packages.qa.debian.org/${p:3:1}/${p#qa:}.html"
21         elif [[ $p = bd:* ]]; then
22                 ${BROWSER:-lynx} "https://buildd.debian.org/status/package.php?p=${p#bd:}"
23         elif [[ $p = bp:* ]]; then
24                 ${BROWSER:-lynx} "http://buildd.debian-ports.org/status/package.php?p=${p#bp:}"
25         elif [[ $p = f:* ]]; then
26                 ${BROWSER:-lynx} "http://packages.debian.org/search?searchon=contents&keywords=${p#f:}&mode=path&suite=unstable&arch=any"
27         else
28                 ${BROWSER:-lynx} "http://packages.debian.org/sid/$p"
29         fi
30 }
31
32 alias doch='sudo mksh -c "$(fc -ln -1)"'