Changeset - 8a438cea1bc4
[Not reviewed]
search
0 4 0
Dennis Fink - 7 years ago 2013-03-08 18:33:13
the_metalgamer@hackerspace.lu
implemented search function and updated documentation
4 files changed with 53 insertions and 14 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,7 +20,7 @@ yaah [options] [packages]
 

	
 
yaah (packages)
 

	
 
yaah -s keywords
 
yaah -s keyword
 

	
 
DESCRIPTION
 
===========
...
 
@@ -29,7 +29,7 @@ Yaah is a helper for the Archlinux User 
 
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. The third function is to search packages in the
 
AUR, which are containing specified keywords.
 
AUR, which are containing specified keyword.
 

	
 
OPTIONS
 
=======
...
 
@@ -37,7 +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 keywords
 
-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.
 

	
man/man8/yaah.8.gz
Show inline comments
 
binary diff not shown
yaah
Show inline comments
...
 
@@ -12,7 +12,7 @@
 
#:                                                     specified directory
 
#:               -s, --search                          Search for packages
 
#:                                                     containing specified
 
#:                                                     keywords
 
#:                                                     keyword
 
#:               -v, --verbose                         Be more verbose, can be
 
#:                                                     supplied at  maximum 2
 
#:                                                     times
...
 
@@ -20,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
...
 
@@ -43,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
...
 
@@ -148,11 +148,50 @@ error() {
 
#=== FUNCTION =================================================================
 
#        Name: search
 
# Description: Search packages in AUR
 
# Parameter *: Keywords to search for
 
# Parameter 1: Keyword to search for
 
#==============================================================================
 

	
 
search() {
 
    return 0
 

	
 
    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
 
}
 

	
 

	
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,7 +20,7 @@ yaah [options] [packages]
 

	
 
yaah (packages)
 

	
 
yaah -s keywords
 
yaah -s keyword
 

	
 
DESCRIPTION
 
===========
...
 
@@ -29,7 +29,7 @@ Yaah is a helper for the Archlinux User 
 
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. The third function is to search packages in the
 
AUR, which are containing specified keywords.
 
AUR, which are containing specified keyword.
 

	
 
OPTIONS
 
=======
...
 
@@ -37,7 +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 keywords
 
-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.
 

	
0 comments (0 inline, 0 general)