From 79739635ca661a019aa8e3cb7c295d371f2c29b8 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 5 Nov 2010 09:34:16 +0100 Subject: [PATCH] Sync zsh-lookup with upstream ...adding grml_bts backend. --- .../functions/Lookup/Backends/LOOKUP_be_grml_bts | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 usr_share_grml/zsh/functions/Lookup/Backends/LOOKUP_be_grml_bts diff --git a/usr_share_grml/zsh/functions/Lookup/Backends/LOOKUP_be_grml_bts b/usr_share_grml/zsh/functions/Lookup/Backends/LOOKUP_be_grml_bts new file mode 100644 index 0000000..619ddb7 --- /dev/null +++ b/usr_share_grml/zsh/functions/Lookup/Backends/LOOKUP_be_grml_bts @@ -0,0 +1,46 @@ +### vim:ft=zsh:foldmethod=marker +## bts.grml.org backend for lookup +## Copyright: 2010, Frank Terbeck + +LOOKUP_guard || return 1 +[[ -n ${lookup_describe} ]] && + printf '%s' 'bts.grml.org bug lookups' && + return 0 + +LOOKUP_guard -fd LOOKUP_help_${backend} || +function LOOKUP_help_${backend}() { + LOOKUP_guard || return 1 + printf 'usage: %s \n' ${backend} + printf '\n Query grml[1]'\''s Bug Tracking System[2].\n' + printf '\n This looks up bugs by bug id in grml'\''s BTS. In this mode, all\n' + printf ' non-digit characters are automatically stripped off of the query.\n' + printf '\nExamples:\n' + printf ' %% lookup %s 123\n' ${backend} + printf ' %% lookup %s "#123"\n' ${backend} + printf '\n[1] \n' + printf '[2] \n' +} +LOOKUP_help && return 0 + +local -x QUERY +local -a comp_args + +if [[ -n ${lookup_complete} ]] ; then + comp_args=( '*:grml bts query:true' ) + + _arguments -s -w -A '-*' ${comp_args} && return 0 + _message 'grml bts query' + return 0 +fi + +QUERY="$*" +LOOKUP_query_handler || return 1 +QUERY="${QUERY//[^0-9]/}" +if [[ -z ${QUERY} ]] ; then + LOOKUP_help -f + return 1 +fi + +LOOKUP_encode -q +LOOKUP_browser "http://bts.grml.org/grml/issue${QUERY}" +return $? -- 2.1.4