# HG changeset patch # User Christophe Lincoln # Date 1487645075 -3600 # Node ID 3d8bf273e46ed9ef02fd2f86702e6d9d56189aa2 # Parent 1f5468a81629c098307eec64abe809567684f7dc Add textmode plugin, rewrite tazbug cmdline tool diff -r 1f5468a81629 -r 3d8bf273e46e po/cli/tazbug-cli.pot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/po/cli/tazbug-cli.pot Tue Feb 21 03:44:35 2017 +0100 @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Tazbug cli\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-21 03:34+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: tazbug:16 +msgid "Usage:" +msgstr "" + +#: tazbug:18 +msgid "Examples:" +msgstr "" + +#: tazbug:41 +msgid "Searching for:" +msgstr "" diff -r 1f5468a81629 -r 3d8bf273e46e po/tazbug.pot --- a/po/tazbug.pot Tue Feb 21 01:19:09 2017 +0100 +++ b/po/tazbug.pot Tue Feb 21 03:44:35 2017 +0100 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: SliTaz Bugs\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-21 01:14+0100\n" +"POT-Creation-Date: 2017-02-21 03:34+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff -r 1f5468a81629 -r 3d8bf273e46e tazbug --- a/tazbug Tue Feb 21 01:19:09 2017 +0100 +++ b/tazbug Tue Feb 21 03:44:35 2017 +0100 @@ -1,20 +1,55 @@ #!/bin/sh # # TazBug Command line tool. Help to search and check bugs from cmdline. +# This tool use data from Tazbug 'textmode' plugin. # # Copyright (C) 2017 SliTaz GNU/Linux - BSD License # . /lib/libtaz.sh -url="http://bugs.slitaz.org/" +#url="http://localhost/~pankso/cgi-bin/tazbug/web/bugs.cgi?textmode" +url="http://bugs.slitaz.org/bugs.cgi?textmode" + +help() { + cat << EOT + +$(boldify $(gettext "Usage:")) tazbug [stats|search|ID] [pattern] + +$(boldify $(gettext "Examples:")) + tazbug 120 + tazbug search firefox + +EOT +} + +# Usage: get "data=xxx" +get() { + busybox wget -q "${url}&${1}" -O - +} # # Commands # case "$1" in - *) - gettext "Usage:"; echo " $(basename $0) [command]" ;; + stats) + newline + get "stats" + newline ;; + search) + newline + echo "$(boldify $(gettext 'Searching for:')) $(colorize 33 $2)" + separator + get "search=$2" + newline ;; + *[0-9]*) + newline + boldify "Bug info" + separator + get "id=$1" + separator && newline ;; + *) + help ;; esac -exit 0 +rm -f ${tmp} && exit 0 diff -r 1f5468a81629 -r 3d8bf273e46e web/plugins/dashboard/dashboard.conf --- a/web/plugins/dashboard/dashboard.conf Tue Feb 21 01:19:09 2017 +0100 +++ b/web/plugins/dashboard/dashboard.conf Tue Feb 21 03:44:35 2017 +0100 @@ -6,5 +6,3 @@ # Authenticated users PLUGINS_TOOLS="Dashboard ${PLUGINS_TOOLS}" - -# Configurable variables used in plugin.cgi diff -r 1f5468a81629 -r 3d8bf273e46e web/plugins/debug/debug.conf --- a/web/plugins/debug/debug.conf Tue Feb 21 01:19:09 2017 +0100 +++ b/web/plugins/debug/debug.conf Tue Feb 21 03:44:35 2017 +0100 @@ -10,5 +10,3 @@ # Admin only in Dashboard ADMIN_TOOLS="${ADMIN_TOOLS} Debug" - -# Configurable variables used in plugin.cgi diff -r 1f5468a81629 -r 3d8bf273e46e web/plugins/packages/packages.conf --- a/web/plugins/packages/packages.conf Tue Feb 21 01:19:09 2017 +0100 +++ b/web/plugins/packages/packages.conf Tue Feb 21 03:44:35 2017 +0100 @@ -9,5 +9,3 @@ # Authenticated users PLUGINS_TOOLS="${PLUGINS_TOOLS}" - -# Configurable variables used in plugin.cgi diff -r 1f5468a81629 -r 3d8bf273e46e web/plugins/skel/skel.conf --- a/web/plugins/skel/skel.conf Tue Feb 21 01:19:09 2017 +0100 +++ b/web/plugins/skel/skel.conf Tue Feb 21 03:44:35 2017 +0100 @@ -3,6 +3,13 @@ PLUGIN="Plugin Skeleton" SHORT_DESC="An example plugin for TinyCM/TazBug" MAINTAINER="devel@slitaz.org" + +# All users +BUGS_TOOLS="${BUGS_TOOLS}" + +# Authenticated users PLUGINS_TOOLS="${PLUGINS_TOOLS}" +DASHBOARD_TOOLS="${DASHBOARD_TOOLS}" -# Configurable variables used in plugin.cgi +# Admin only in Dashboard +ADMIN_TOOLS="${ADMIN_TOOLS}" diff -r 1f5468a81629 -r 3d8bf273e46e web/plugins/textmode/textmode.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/plugins/textmode/textmode.cgi Tue Feb 21 03:44:35 2017 +0100 @@ -0,0 +1,65 @@ +#!/bin/sh +# +# TazBug Plugin - Textmode will output plain data to be used by remote client +# + +if [ "$(GET textmode)" ]; then + header "Content-type: text/plain; charset=UTF-8" + + separator() { + echo "-------------------------------------------------------------------------------" + } + + case " $(GET) " in + + *\ stats\ *) + echo "Bugs count : $(ls $bugdir | wc -l)" + echo "Database size : $(du -sh $bugdir | awk '{print $1}')" ;; + + *\ search\ *) + for bug in $(ls $bugdir) + do + result=$(fgrep -i -h "$(GET search)" $bugdir/$bug/*) + if [ "$result" ]; then + found=$(($found + 1)) + . ${bugdir}/${bug}/bug.conf + echo "Bug: $bug - $BUG" + fi + done + if [ "$found" == "" ]; then + echo "No result found for: $(GET search)" + else + separator && echo "$found result(s) found" + fi ;; + + *\ id\ *) + # Show bug information and description + id=$(GET id) + if [ -f "$bugdir/$id/bug.conf" ]; then + . ${bugdir}/${id}/bug.conf + cat << EOT +Bug : $id - $STATUS - $PRIORITY +Title : $BUG +Info : $DATE - Creator: $CREATOR +$(separator) +$(cat $bugdir/$id/desc.txt) +EOT + else + echo "Can't found bug ID: $id" && exit 0 + fi ;; + + *) + cat << EOT +Tazbug Textmode plugin +$(separator) +$(date) + +Functions: + &stats Display bug tracker stats + &search= Search for bugs by pattern + &id= Show bug info and description +EOT + ;; + esac + exit 0 +fi diff -r 1f5468a81629 -r 3d8bf273e46e web/plugins/textmode/textmode.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/plugins/textmode/textmode.conf Tue Feb 21 03:44:35 2017 +0100 @@ -0,0 +1,5 @@ +# TinyCM/TazBug Plugin configuration + +PLUGIN="Textmode functions" +SHORT_DESC="Get Tazbug data in raw textmode" +MAINTAINER="devel@slitaz.org"