Changeset - 23edd2b37631
[Not reviewed]
default
0 4 0
Dennis Fink - 7 years ago 2013-05-27 17:14:08
the_metalgamer@hackerspace.lu
update
4 files changed with 53 insertions and 25 deletions:
0 comments (0 inline, 0 general)
README.rst
Show inline comments
...
 
@@ -9,7 +9,7 @@ Yet another AUR helper
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2013-05-19
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.4.1
 
:Version:        Yaah 0.4.3
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
man/man8/yaah.8.gz
Show inline comments
 
binary diff not shown
yaah
Show inline comments
...
 
@@ -11,7 +11,7 @@
 
#:               -q, --quiet                            Be less verbose. Takes precedence over -v and --verbose
 
#:               --version                              Prints version and exits
 
#: Requirements: jshon <http://kmkeen.com/jshon/>, pacman, tar, curl
 
#:      Version: 0.4.2
 
#:      Version: 0.4.3
 
#:      Created: 2013-02-26
 
#:     Revision: 2013-05-27
 
#:       Author: Dennis Fink <the_metalgamer@hackerspace.lu>
...
 
@@ -37,7 +37,7 @@ SCRIPTNAME=${0##*/}
 
DESCRIPTION="Yet another AUR helper"
 
DATE_OF_CREATION=2013-02-26
 
DATE_OF_REVISION=2013-05-27
 
VERSION=0.4.2
 
VERSION=0.4.3
 
AUTHOR="Dennis Fink <the_metalgamer@hackerspace.lu>"
 

	
 
readonly SCRIPTNAME DESCRIPTION DATE_OF_CREATION DATE_OF_REVISION VERSION AUTHOR
...
 
@@ -52,27 +52,55 @@ readonly AURURL
 
if tput setaf 0 $>/dev/null; then
 
    ALL_OFF="$(tput sgr0)"
 
    BOLD="$(tput bold)"
 
    BLUE="${BOLD}$(tput setaf 4)"
 
    RED="${BOLD}$(tput setaf 1)"
 
    GREEN="${BOLD}$(tput setaf 2)"
 
    RED="${BOLD}$(tput setaf 1)"
 
    YELLOW="${BOLD}$(tput setaf 3)"
 
    COLS="$(tput cols)"
 
    BLUE="${BOLD}$(tput setaf 4)"
 
    PURPLE="${BOLD}$(tput setaf 5)"
 
    CYAN="${BOLD}$(tput setaf 6)"
 
    WHITE="${BOLD}$(tput setaf 7)"
 
else
 
    ALL_OFF="\e[1;0m"
 
    BOLD="\[1;1m"
 
    BLUE="${BOLD}\e[1;34m"
 
    RED="${BOLD}\e[1;31m"
 
    GREEN="${BOLD}\e[1;32m"
 
    RED="${BOLD}\e[1;31m"
 
    YELLOW="${BOLD}\e[1;33m"
 
    COLS="$COLUMNS"
 
    BLUE="${BOLD}\e[1;34m"
 
    PURPLE="${BOLD}\e[1:35m"
 
    CYAN="${BOLD}\e[1:36m"
 
    WHITE="${BOLD}\e[1:37m"
 
fi
 
COLS="$(tput cols)"
 

	
 
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW COLS
 
readonly ALL_OFF BOLD RED GREEN YELLOW BLUE PURPLE CYAN WHITE COLS
 

	
 
# Alias jshon to jshon -Q
 
alias jshon='jshon -Q'
 
alias curl='curl -s -fL'
 

	
 
# Categories
 
CATEGORIES=('none' \
 
            'daemons' \
 
            'devel' \
 
            'editors' \
 
            'emulators' \
 
            'games' \
 
            'gnome' \
 
            'i18n' \
 
            'kde' \
 
            'lib' \
 
            'modules' \
 
            'multimedia' \
 
            'network' \
 
            'office' \
 
            'science' \
 
            'system' \
 
            'x11' \
 
            'xfce' \
 
            'kernels')
 

	
 
readonly CATEGORIES
 

	
 
#=== FUNCTION =================================================================
 
#        Name: msg
 
# Description: Print message with a green pretag if $quiet is not set
...
 
@@ -158,7 +186,7 @@ search() {
 

	
 
    msg_verbose2 "URL is: ${url}"
 

	
 
    aur_response=$(curl "${url}")
 
    aur_response=$(jshon -e results <<< $(curl "${url}"))
 

	
 
    if [[ $? -ne 0 ]]; then
 
        error "Packages infos could not be loaded!"
...
 
@@ -167,36 +195,36 @@ search() {
 

	
 
    msg_verbose2 "Getting numbers of objects in json array!"
 

	
 
    local results=$(jshon -e results <<< "$aur_response")
 
    local number=$(jshon -l <<< "$results")
 
    local number=$(jshon -l <<< "$aur_response")
 

	
 
    msg_verbose1 "There are $number packages found."
 
    msg_verbose2 "Looping over json array!"
 

	
 
    printf "\n"
 
    for i in $(seq 0 $(( $number -1 )) ); do
 

	
 
        local package=$(jshon -e $i <<< "$results")
 
        local package=$(jshon -e $i <<< "$aur_response")
 

	
 
        local package_name=$(jshon -e Name <<< "$package")
 
        local package_version=$(jshon -e Version <<< "$package")
 
        local package_description=$(jshon -e Description <<< "$package")
 
        local package_description=$(fold -sw $COLS <<< $(jshon -e Description <<< "$package"))
 
        local out_of_date=$(jshon -e OutOfDate <<< "$package")
 
        local num_votes=$(jshon -e NumVotes <<< "$package")
 
        local category=${CATEGORIES[$(jshon -e CategoryID <<< "$package")]}
 
        local maintainer=$(jshon -e Maintainer <<< "$package")
 

	
 
        # removing quotes
 
        package_name=${package_name//\"}
 
        package_version=${package_version//\"}
 
        package_description=${package_description//\"}
 
        maintainer=${maintainer//\"}
 

	
 
        printf "$package_name "
 

	
 
        if [[ $out_of_date -eq 0 ]]; then
 
            printf "${GREEN}$package_version"
 
            local color="${GREEN}"
 
        else
 
            printf "${RED}$package_version"
 
            local color="${RED}"
 
        fi
 
        description=$(fold -s -w $COLS <<< "$package_description")
 
        printf "${ALL_OFF}\n$description\n\n"
 
        printf "\n${PURPLE}$category/${ALL_OFF}$package_name ${color}$package_version${ALL_OFF} ${YELLOW}$num_votes${ALL_OFF} ${CYAN}$maintainer${ALL_OFF}\n$package_description\n"
 

	
 
    done
 
}
...
 
@@ -254,7 +282,7 @@ query_online_version () {
 

	
 
        msg_verbose2 "URL is: ${url}"
 

	
 
        local aur_response=$(curl  "${url}")
 
        local aur_response=$(jshon -e results <<< $(curl  "${url}"))
 

	
 
        if [[ $? -ne 0 ]]; then
 
            error "Packages infos could not be loaded!"
...
 
@@ -263,7 +291,7 @@ query_online_version () {
 

	
 
        msg_verbose2 "Getting numbers of objects in json array!"
 

	
 
        local number=$(jshon -e results -l <<< "$aur_response")
 
        local number=$(jshon -l <<< "$aur_response")
 

	
 
        msg_verbose2 "Looping over json array!"
 

	
...
 
@@ -271,7 +299,7 @@ query_online_version () {
 

	
 
            msg_verbose2 "Extracting package name."
 

	
 
            local package=$(jshon -e results -e $i <<< "$aur_response")
 
            local package=$(jshon -e $i <<< "$aur_response")
 
            local package_name=$(jshon -e Name <<< "$package")
 
            package_name=${package_name//\"}
 

	
yaah.rst
Show inline comments
...
 
@@ -9,7 +9,7 @@ Yet another AUR helper
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2013-05-19
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.4.2
 
:Version:        Yaah 0.4.3
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
0 comments (0 inline, 0 general)