Changeset - 87f50074ca60
[Not reviewed]
Merge default
0 4 0
Dennis Fink - 7 years ago 2013-03-08 18:35:27
the_metalgamer@hackerspace.lu
merged search into default
4 files changed with 85 insertions and 9 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-03-04
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.1.1
 
:Version:        Yaah 0.2.0
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
...
 
@@ -20,13 +20,16 @@ yaah [options] [packages]
 

	
 
yaah (packages)
 

	
 
yaah -s keyword
 

	
 
DESCRIPTION
 
===========
 

	
 
Yaah is a helper for the Archlinux User Repository (AUR). It has two main
 
Yaah is a helper for the Archlinux User Repository (AUR). It has tree main
 
functions. First of all, it can download packages, from the AUR by their
 
package name. The second function is to check installed foreign packages, if
 
there are updates available.
 
there are updates available. The third function is to search packages in the
 
AUR, which are containing specified keyword.
 

	
 
OPTIONS
 
=======
...
 
@@ -34,6 +37,7 @@ OPTIONS
 
-h, --help                              Display help.
 
-c, --check                             Check installed, foreign packages, if there are updates available.
 
-d directory, --downloaddir=directory   Download packages to the specified directory.
 
-s, --search                            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.
 

	
...
 
@@ -52,6 +56,9 @@ yaah -c
 
yaah -c task-git
 
    Check if there is a update available for task-git.
 

	
 
yaah -s task
 
    Search for packages containing the keyword task
 

	
 
yaah -c -v
 
    Be more verbose at checking.
 

	
man/man8/yaah.8.gz
Show inline comments
 
binary diff not shown
yaah
Show inline comments
...
 
@@ -3,12 +3,16 @@
 
#:        Title: yaah - Yet another AUR helper
 
#:     Synopsis: yaah [options] [packages]
 
#:               yaah (packages)
 
#:               yaah -s keywords
 
#:      Options: -h, --help                            Display help
 
#:               -c, --check                           Check installed, foreign
 
#:                                                     packages if there are
 
#:                                                     updates available
 
#:               -d directory, --downloaddir=directory Download packages to the
 
#:                                                     specified directory
 
#:               -s, --search                          Search for packages
 
#:                                                     containing specified
 
#:                                                     keyword
 
#:               -v, --verbose                         Be more verbose, can be
 
#:                                                     supplied at  maximum 2
 
#:                                                     times
...
 
@@ -16,9 +20,9 @@
 
#:                                                     precedence over -v and
 
#:                                                     --verbose
 
#: Requirements: jshon <http://kmkeen.com/jshon/>
 
#:      Version: 0.1.1
 
#:      Version: 0.2.0
 
#:      Created: 2013-02-26
 
#:     Revision: 2013-03-05
 
#:     Revision: 2013-03-08
 
#:       Author: Dennis Fink <the_metalgamer@hackerspace.lu>
 

	
 
## Security
...
 
@@ -39,7 +43,7 @@ umask $UMASK
 
SCRIPTNAME=${0##*/}
 
DESCRIPTION="Yet another AUR helper"
 
DATE_OF_CREATION=2013-02-26
 
VERSION=0.1.1
 
VERSION=0.2.0
 
AUTHOR="Dennis Fink <the_metalgamer@hackerspace.lu>"
 

	
 
readonly SCRIPTNAME DESCRIPTION DATE_OF_CREATION VERSION AUTHOR
...
 
@@ -142,6 +146,56 @@ error() {
 
}
 

	
 
#=== FUNCTION =================================================================
 
#        Name: search
 
# Description: Search packages in AUR
 
# Parameter 1: Keyword to search for
 
#==============================================================================
 

	
 
search() {
 

	
 
    msg "Searching AUR for $1"
 

	
 
    msg_verbose2 "URL is: ${AURURL}rpc.php?type=search&arg=$1"
 

	
 
    aur_response=$(curl -s -fL "${AURURL}rpc.php?type=search&arg=$1")
 

	
 
    if [[ $? -ne 0 ]]; then
 
        error "Packages infos could not be loaded!"
 
        return 2
 
    fi
 

	
 
    msg_verbose2 "Getting numbers of objects in json array!"
 

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

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

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

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

	
 
        local package_name=$(jshon -Q -e Name <<< $package)
 
        local package_version=$(jshon -Q -e Version <<< $package)
 
        local package_description=$(jshon -Q -e Description <<< $package)
 
        local out_of_date=$(jshon -Q -e OutOfDate <<< $package)
 

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

	
 
        if [[ $out_of_date -eq 0 ]]; then
 
            printf "$package_name $package_version\n $package_description\n\n"
 
        else
 
            printf "${RED}$package_name $package_version${ALL_OFF}\n $package_description\n\n"
 
        fi
 

	
 
    done
 
}
 

	
 

	
 
#=== FUNCTION =================================================================
 
#        Name: check_version
 
# Description: Check version between two packages and print a message if the
 
#              later one is newer
...
 
@@ -346,6 +400,7 @@ usage() {
 
    -h, --help                              Display help
 
    -c, --check                             Check installed packages if there are updates
 
    -d directory, --downloaddir=directory   Download packages to the specified directory
 
    -s, --search                            Search for packages containing specified keywords
 
    -v, --verbose                           Be more verbose, can be supplied at maximum 2 times
 
    -q, --quiet                             Be less verbose. Takes precedence over -v and --verbose
 

	
...
 
@@ -354,6 +409,7 @@ usage() {
 

	
 

	
 
check_flag=
 
search_flag=
 
verbose=0
 
quiet=0
 
downloaddir="$PWD"
...
 
@@ -393,6 +449,10 @@ while true; do
 
            quiet=1
 
            shift
 
            ;;
 
        -s|--search)
 
            search_flag=1
 
            shift
 
            ;;
 
        --)
 
            shift
 
            break
...
 
@@ -418,6 +478,8 @@ fi
 

	
 
if [[ "$check_flag" ]]; then
 
    query_local_version $@
 
elif [[ "$search_flag" ]]; then
 
    search $@
 
else
 
    download $@
 
fi
yaah.rst
Show inline comments
...
 
@@ -9,7 +9,7 @@ Yet another AUR helper
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2013-03-04
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.1.1
 
:Version:        Yaah 0.2.0
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
...
 
@@ -20,13 +20,16 @@ yaah [options] [packages]
 

	
 
yaah (packages)
 

	
 
yaah -s keyword
 

	
 
DESCRIPTION
 
===========
 

	
 
Yaah is a helper for the Archlinux User Repository (AUR). It has two main
 
Yaah is a helper for the Archlinux User Repository (AUR). It has tree main
 
functions. First of all, it can download packages, from the AUR by their
 
package name. The second function is to check installed foreign packages, if
 
there are updates available.
 
there are updates available. The third function is to search packages in the
 
AUR, which are containing specified keyword.
 

	
 
OPTIONS
 
=======
...
 
@@ -34,6 +37,7 @@ OPTIONS
 
-h, --help                              Display help.
 
-c, --check                             Check installed, foreign packages, if there are updates available.
 
-d directory, --downloaddir=directory   Download packages to the specified directory.
 
-s, --search                            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.
 

	
...
 
@@ -52,6 +56,9 @@ yaah -c
 
yaah -c task-git
 
    Check if there is a update available for task-git.
 

	
 
yaah -s task
 
    Search for packages containing the keyword task
 

	
 
yaah -c -v
 
    Be more verbose at checking.
 

	
0 comments (0 inline, 0 general)