tazbug rev 126
Add textmode plugin, rewrite tazbug cmdline tool
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Feb 21 03:44:35 2017 +0100 (2017-02-21) |
parents | 1f5468a81629 |
children | 493fa176c185 |
files | po/cli/tazbug-cli.pot po/tazbug.pot tazbug web/plugins/dashboard/dashboard.conf web/plugins/debug/debug.conf web/plugins/packages/packages.conf web/plugins/skel/skel.conf web/plugins/textmode/textmode.cgi web/plugins/textmode/textmode.conf |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/po/cli/tazbug-cli.pot Tue Feb 21 03:44:35 2017 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +# SOME DESCRIPTIVE TITLE. 1.5 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 1.6 +# This file is distributed under the same license as the PACKAGE package. 1.7 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 1.8 +# 1.9 +#, fuzzy 1.10 +msgid "" 1.11 +msgstr "" 1.12 +"Project-Id-Version: Tazbug cli\n" 1.13 +"Report-Msgid-Bugs-To: \n" 1.14 +"POT-Creation-Date: 2017-02-21 03:34+0100\n" 1.15 +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 1.16 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 1.17 +"Language-Team: LANGUAGE <LL@li.org>\n" 1.18 +"Language: \n" 1.19 +"MIME-Version: 1.0\n" 1.20 +"Content-Type: text/plain; charset=CHARSET\n" 1.21 +"Content-Transfer-Encoding: 8bit\n" 1.22 + 1.23 +#: tazbug:16 1.24 +msgid "Usage:" 1.25 +msgstr "" 1.26 + 1.27 +#: tazbug:18 1.28 +msgid "Examples:" 1.29 +msgstr "" 1.30 + 1.31 +#: tazbug:41 1.32 +msgid "Searching for:" 1.33 +msgstr ""
2.1 --- a/po/tazbug.pot Tue Feb 21 01:19:09 2017 +0100 2.2 +++ b/po/tazbug.pot Tue Feb 21 03:44:35 2017 +0100 2.3 @@ -8,7 +8,7 @@ 2.4 msgstr "" 2.5 "Project-Id-Version: SliTaz Bugs\n" 2.6 "Report-Msgid-Bugs-To: \n" 2.7 -"POT-Creation-Date: 2017-02-21 01:14+0100\n" 2.8 +"POT-Creation-Date: 2017-02-21 03:34+0100\n" 2.9 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 2.10 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 2.11 "Language-Team: LANGUAGE <LL@li.org>\n"
3.1 --- a/tazbug Tue Feb 21 01:19:09 2017 +0100 3.2 +++ b/tazbug Tue Feb 21 03:44:35 2017 +0100 3.3 @@ -1,20 +1,55 @@ 3.4 #!/bin/sh 3.5 # 3.6 # TazBug Command line tool. Help to search and check bugs from cmdline. 3.7 +# This tool use data from Tazbug 'textmode' plugin. 3.8 # 3.9 # Copyright (C) 2017 SliTaz GNU/Linux - BSD License 3.10 # 3.11 . /lib/libtaz.sh 3.12 3.13 -url="http://bugs.slitaz.org/" 3.14 +#url="http://localhost/~pankso/cgi-bin/tazbug/web/bugs.cgi?textmode" 3.15 +url="http://bugs.slitaz.org/bugs.cgi?textmode" 3.16 + 3.17 +help() { 3.18 + cat << EOT 3.19 + 3.20 +$(boldify $(gettext "Usage:")) tazbug [stats|search|ID] [pattern] 3.21 + 3.22 +$(boldify $(gettext "Examples:")) 3.23 + tazbug 120 3.24 + tazbug search firefox 3.25 + 3.26 +EOT 3.27 +} 3.28 + 3.29 +# Usage: get "data=xxx" 3.30 +get() { 3.31 + busybox wget -q "${url}&${1}" -O - 3.32 +} 3.33 3.34 # 3.35 # Commands 3.36 # 3.37 3.38 case "$1" in 3.39 - *) 3.40 - gettext "Usage:"; echo " $(basename $0) [command]" ;; 3.41 + stats) 3.42 + newline 3.43 + get "stats" 3.44 + newline ;; 3.45 + search) 3.46 + newline 3.47 + echo "$(boldify $(gettext 'Searching for:')) $(colorize 33 $2)" 3.48 + separator 3.49 + get "search=$2" 3.50 + newline ;; 3.51 + *[0-9]*) 3.52 + newline 3.53 + boldify "Bug info" 3.54 + separator 3.55 + get "id=$1" 3.56 + separator && newline ;; 3.57 + *) 3.58 + help ;; 3.59 esac 3.60 3.61 -exit 0 3.62 +rm -f ${tmp} && exit 0
4.1 --- a/web/plugins/dashboard/dashboard.conf Tue Feb 21 01:19:09 2017 +0100 4.2 +++ b/web/plugins/dashboard/dashboard.conf Tue Feb 21 03:44:35 2017 +0100 4.3 @@ -6,5 +6,3 @@ 4.4 4.5 # Authenticated users 4.6 PLUGINS_TOOLS="<a href='?dashboard'>Dashboard</a> ${PLUGINS_TOOLS}" 4.7 - 4.8 -# Configurable variables used in plugin.cgi
5.1 --- a/web/plugins/debug/debug.conf Tue Feb 21 01:19:09 2017 +0100 5.2 +++ b/web/plugins/debug/debug.conf Tue Feb 21 03:44:35 2017 +0100 5.3 @@ -10,5 +10,3 @@ 5.4 5.5 # Admin only in Dashboard 5.6 ADMIN_TOOLS="${ADMIN_TOOLS} <a href='?debug'>Debug</a>" 5.7 - 5.8 -# Configurable variables used in plugin.cgi
6.1 --- a/web/plugins/packages/packages.conf Tue Feb 21 01:19:09 2017 +0100 6.2 +++ b/web/plugins/packages/packages.conf Tue Feb 21 03:44:35 2017 +0100 6.3 @@ -9,5 +9,3 @@ 6.4 6.5 # Authenticated users 6.6 PLUGINS_TOOLS="${PLUGINS_TOOLS}" 6.7 - 6.8 -# Configurable variables used in plugin.cgi
7.1 --- a/web/plugins/skel/skel.conf Tue Feb 21 01:19:09 2017 +0100 7.2 +++ b/web/plugins/skel/skel.conf Tue Feb 21 03:44:35 2017 +0100 7.3 @@ -3,6 +3,13 @@ 7.4 PLUGIN="Plugin Skeleton" 7.5 SHORT_DESC="An example plugin for TinyCM/TazBug" 7.6 MAINTAINER="devel@slitaz.org" 7.7 + 7.8 +# All users 7.9 +BUGS_TOOLS="${BUGS_TOOLS}" 7.10 + 7.11 +# Authenticated users 7.12 PLUGINS_TOOLS="${PLUGINS_TOOLS}" 7.13 +DASHBOARD_TOOLS="${DASHBOARD_TOOLS}" 7.14 7.15 -# Configurable variables used in plugin.cgi 7.16 +# Admin only in Dashboard 7.17 +ADMIN_TOOLS="${ADMIN_TOOLS}"
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/web/plugins/textmode/textmode.cgi Tue Feb 21 03:44:35 2017 +0100 8.3 @@ -0,0 +1,65 @@ 8.4 +#!/bin/sh 8.5 +# 8.6 +# TazBug Plugin - Textmode will output plain data to be used by remote client 8.7 +# 8.8 + 8.9 +if [ "$(GET textmode)" ]; then 8.10 + header "Content-type: text/plain; charset=UTF-8" 8.11 + 8.12 + separator() { 8.13 + echo "-------------------------------------------------------------------------------" 8.14 + } 8.15 + 8.16 + case " $(GET) " in 8.17 + 8.18 + *\ stats\ *) 8.19 + echo "Bugs count : $(ls $bugdir | wc -l)" 8.20 + echo "Database size : $(du -sh $bugdir | awk '{print $1}')" ;; 8.21 + 8.22 + *\ search\ *) 8.23 + for bug in $(ls $bugdir) 8.24 + do 8.25 + result=$(fgrep -i -h "$(GET search)" $bugdir/$bug/*) 8.26 + if [ "$result" ]; then 8.27 + found=$(($found + 1)) 8.28 + . ${bugdir}/${bug}/bug.conf 8.29 + echo "Bug: $bug - $BUG" 8.30 + fi 8.31 + done 8.32 + if [ "$found" == "" ]; then 8.33 + echo "No result found for: $(GET search)" 8.34 + else 8.35 + separator && echo "$found result(s) found" 8.36 + fi ;; 8.37 + 8.38 + *\ id\ *) 8.39 + # Show bug information and description 8.40 + id=$(GET id) 8.41 + if [ -f "$bugdir/$id/bug.conf" ]; then 8.42 + . ${bugdir}/${id}/bug.conf 8.43 + cat << EOT 8.44 +Bug : $id - $STATUS - $PRIORITY 8.45 +Title : $BUG 8.46 +Info : $DATE - Creator: $CREATOR 8.47 +$(separator) 8.48 +$(cat $bugdir/$id/desc.txt) 8.49 +EOT 8.50 + else 8.51 + echo "Can't found bug ID: $id" && exit 0 8.52 + fi ;; 8.53 + 8.54 + *) 8.55 + cat << EOT 8.56 +Tazbug Textmode plugin 8.57 +$(separator) 8.58 +$(date) 8.59 + 8.60 +Functions: 8.61 + &stats Display bug tracker stats 8.62 + &search= Search for bugs by pattern 8.63 + &id= Show bug info and description 8.64 +EOT 8.65 + ;; 8.66 + esac 8.67 + exit 0 8.68 +fi
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/web/plugins/textmode/textmode.conf Tue Feb 21 03:44:35 2017 +0100 9.3 @@ -0,0 +1,5 @@ 9.4 +# TinyCM/TazBug Plugin configuration 9.5 + 9.6 +PLUGIN="Textmode functions" 9.7 +SHORT_DESC="Get Tazbug data in raw textmode" 9.8 +MAINTAINER="devel@slitaz.org"