Changeset - ec93c8e4f79d
[Not reviewed]
default
0 5 0
Dennis Fink - 7 years ago 2013-06-14 22:16:13
the_metalgamer@hackerspace.lu
added parseable format and removed some typos and little bugs
5 files changed with 38 insertions and 17 deletions:
0 comments (0 inline, 0 general)
README.rst
Show inline comments
...
 
@@ -7,9 +7,9 @@ Yet another AUR helper
 
----------------------
 

	
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2013-05-19
 
:Date:           2013-06-14
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.4.4
 
:Version:        Yaah 0.5.0
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
...
 
@@ -34,6 +34,7 @@ OPTIONS
 

	
 
-h, --help                              Display help.
 
-c, --check                             Check installed, foreign packages, if there are updates available.
 
-p, --parseable                         Check installed, foreign packages, if there are updates available and print them in a parseable format.
 
-d DIRECTORY, --downloaddir DIRECTORY   Download packages to the specified directory.
 
-s KEYWORD, --search KEYWORD            Search for packages containing specified keyword.
 
-v, --verbose                           Be more verbose, can be supplied at maximum 2 times.
man/man8/yaah.8.gz
Show inline comments
 
binary diff not shown
yaah
Show inline comments
...
 
@@ -5,15 +5,16 @@
 
#:               yaag [options] [<packages]...
 
#:      Options: -h, --help                             Display help
 
#:               -c, --check                            Check installed, foreign packages if there are updates available
 
#:               -p, --parseable                        Check installed, foreing pacakges if there are updates available and print them in a parsable format
 
#:               -d DIRECTORY, --downloaddir DIRECTORY  Download packages to the specified directory
 
#:               -s KEYWORD, --search KEYWORD           Search for packages containing specified keyword
 
#:               -v, --verbose                          Be more verbose, can be supplied at  maximum 2 times
 
#:               -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.4
 
#:      Version: 0.5.0
 
#:      Created: 2013-02-26
 
#:     Revision: 2013-06-11
 
#:     Revision: 2013-06-14
 
#:       Author: Dennis Fink <the_metalgamer@hackerspace.lu>
 

	
 
## Security
...
 
@@ -36,8 +37,8 @@ shopt -s expand_aliases
 
SCRIPTNAME=${0##*/}
 
DESCRIPTION="Yet another AUR helper"
 
DATE_OF_CREATION=2013-02-26
 
DATE_OF_REVISION=2013-06-11
 
VERSION=0.4.4
 
DATE_OF_REVISION=2013-06-14
 
VERSION=0.5.0
 
AUTHOR="Dennis Fink <the_metalgamer@hackerspace.lu>"
 

	
 
readonly SCRIPTNAME DESCRIPTION DATE_OF_CREATION DATE_OF_REVISION VERSION AUTHOR
...
 
@@ -125,7 +126,7 @@ msg () {
 
msg_verbose1 () {
 

	
 
    if [[ $verbose -ge 1 ]]; then
 
        msg $1
 
        msg "$1"
 
    fi
 

	
 
}
...
 
@@ -139,7 +140,7 @@ msg_verbose1 () {
 
msg_verbose2 () {
 

	
 
    if [[ $verbose -ge 2 ]]; then
 
        msg $1
 
        msg "$1"
 
    fi
 

	
 
}
...
 
@@ -193,13 +194,17 @@ search() {
 
        return 2
 
    fi
 

	
 
    msg_verbose2 "Getting numbers of objects in json array!"
 
    msg_verbose2 "Getting number of objects in json array!"
 

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

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

	
 
    if [[ "$quiet" -eq 0 ]]; then
 
        printf "\n"
 
    fi
 

	
 
    for i in $(seq 0 $(( $number -1 )) ); do
 

	
 
        local package=$(jshon -e $i <<< "$aur_response")
...
 
@@ -225,7 +230,7 @@ search() {
 
        else
 
            local color="${RED}"
 
        fi
 
        printf "\n${PURPLE}$category/${ALL_OFF}$package_name ${color}$package_version${ALL_OFF} ${BLUE}$last_modified${ALL_OFF} ${YELLOW}$num_votes${ALL_OFF} ${CYAN}$maintainer${ALL_OFF}\n$package_description\n"
 
        printf "${PURPLE}$category/${ALL_OFF}$package_name ${color}$package_version${ALL_OFF} ${BLUE}$last_modified${ALL_OFF} ${YELLOW}$num_votes${ALL_OFF} ${CYAN}$maintainer${ALL_OFF}\n$package_description\n"
 

	
 
    done
 
}
...
 
@@ -244,10 +249,16 @@ check_version () {
 

	
 
    if [[ $# -eq 3 ]]; then
 

	
 
        msg "Checking version for '$1'"
 
        if [[ "$parseable_flag" ]]; then
 
            if [[ $(vercmp $2 $3) -eq -1 ]]; then
 
                printf "$1 ${GREEN}$3${ALL_OFF}"
 
            fi
 
        else
 
            msg "Checking version for '$1'"
 

	
 
        if [[ $(vercmp $2 $3) -eq -1 ]]; then
 
            msg2 "New version for '$1': $2 -> $3"
 
            if [[ $(vercmp $2 $3) -eq -1 ]]; then
 
                msg2 "New version for '$1': $2 -> $3"
 
            fi
 
        fi
 
    else
 
        error "Not enough parameters supplied"
...
 
@@ -290,7 +301,7 @@ query_online_version () {
 
            return 2
 
        fi
 

	
 
        msg_verbose2 "Getting numbers of objects in json array!"
 
        msg_verbose2 "Getting number of objects in json array!"
 

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

	
...
 
@@ -463,6 +474,7 @@ usage() {
 
    Options:
 
      -h, --help                             Display help
 
      -c, --check                            Check installed, foreign packages if there are updates available
 
      -p, --parseable                        Check installed, foreing packages if there are updates available and print them in a parseable format
 
      -d DIRECTORY, --downloaddir DIRECTORY  Download packages to the specified directory
 
      -s KEYWORD, --search KEYWORD           Search for packages containing specified keyword
 
      -v, --verbose                          Be more verbose, can be supplied at  maximum 2 times
...
 
@@ -475,6 +487,7 @@ usage() {
 

	
 
check_flag=
 
search_flag=
 
parseable_flag=
 
verbose=0
 
quiet=0
 
downloaddir="$PWD"
...
 
@@ -521,6 +534,12 @@ while true; do
 
            search_flag=1
 
            shift
 
            ;;
 
        -p|--parseable)
 
            check_flag=1
 
            parseable_flag=1
 
            quiet=1
 
            shift
 
            ;;
 
        --version)
 
            version
 
            exit 0
yaah.completion
Show inline comments
...
 
@@ -4,7 +4,7 @@
 
    COMPREPLY=()
 
    cur="${COMP_WORDS[COMP_CWORD]}"
 
    prev="${COMP_WORDS[COMP_CWORD-1]}"
 
    opts="-h --help -c --check -s --search -v --verbose -q --quiet --version --downloaddir -d"
 
    opts="-h --help -c --check -s --search -v --verbose -q --quiet --version --downloaddir -d -p --parseable"
 

	
 
    if [[ ${prev} == "-d" ]]; then
 
        COMPREPLY=( $(compgen -d -- ${cur}) )
yaah.rst
Show inline comments
...
 
@@ -7,9 +7,9 @@ Yet another AUR helper
 
----------------------
 

	
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2013-05-19
 
:Date:           2013-06-14
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.4.3
 
:Version:        Yaah 0.5.0
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
...
 
@@ -34,6 +34,7 @@ OPTIONS
 

	
 
-h, --help                              Display help.
 
-c, --check                             Check installed, foreign packages, if there are updates available.
 
-p, --parseable                         Check installed, foreign packages, if there are updates available and print them in a parseable format.
 
-d DIRECTORY, --downloaddir DIRECTORY   Download packages to the specified directory.
 
-s KEYWORD, --search KEYWORD            Search for packages containing specified keyword.
 
-v, --verbose                           Be more verbose, can be supplied at maximum 2 times.
0 comments (0 inline, 0 general)