6bae04e57a50b1f7395745bb06043a73b858685d
[shellsnippets/shellsnippets.git] / bash-ksh / profile-funcs
1 # Debian Bug Tracking System
2 bts() {
3         if [[ $1 = +([0-9]) ]]; then
4                 ${BROWSER:-lynx} "https://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/${1%%_*}"
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 ]' r=''
14
15         if [[ $p = src:* ]]; then
16                 ${BROWSER:-lynx} "https://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} "https://packages.debian.org/search?searchon=contents&keywords=${1#f:}&mode=path&suite=unstable&arch=any"
27         elif [[ $p = p:* ]]; then
28                 ${BROWSER:-lynx} "https://packages.debian.org/${p#p:}"
29         elif [[ $p = ap:* ]]; then
30                 ${BROWSER:-lynx} "http://archive.debian.net/${p#ap:}"
31         elif [[ $p = up:* ]]; then
32                 ${BROWSER:-lynx} "http://packages.ubuntu.com/${p#up:}"
33         elif [[ $p = ab:* ]]; then
34                 ${BROWSER:-lynx} "http://snapshot.debian.org/binary/${p#ab:}/"
35         elif [[ $p = as:* ]]; then
36                 if [[ $1 = *_* ]]; then
37                         r=${1#*_}
38                         r=${r%%_*}/
39                 fi
40                 ${BROWSER:-lynx} "http://snapshot.debian.org/package/${p#as:}/$r"
41         else
42                 ${BROWSER:-lynx} "https://packages.debian.org/sid/$p"
43         fi
44 }
45
46 alias doch='sudo mksh -c "$(fc -ln -1)"'