Changeset - fa194c1489f7
[Not reviewed]
default
0 1 0
Dennis Fink (metalgamer) - 6 years ago 2014-03-21 14:42:12
dennis.fink@c3l.lu
use associative array for categories, use more specified keywords in search and use %s in printf in usage and version
1 file changed with 35 insertions and 35 deletions:
yaah
35
35
0 comments (0 inline, 0 general)
yaah
Show inline comments
...
 
@@ -78,25 +78,25 @@ 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')
 
declare -A CATEGORIES=(['1']='none' \
 
            ['2']='daemons' \
 
            ['3']='devel' \
 
            ['4']='editors' \
 
            ['5']='emulators' \
 
            ['6']='games' \
 
            ['7']='gnome' \
 
            ['8']='i18n' \
 
            ['9']='kde' \
 
            ['10']='lib' \
 
            ['11']='modules' \
 
            ['12']='multimedia' \
 
            ['13']='network' \
 
            ['14']='office' \
 
            ['15']='science' \
 
            ['16']='system' \
 
            ['17']='x11' \
 
            ['18']='xfce' \
 
            ['19']='kernels')
 

	
 
readonly CATEGORIES
 

	
...
 
@@ -174,14 +174,14 @@ error() {
 
#=== FUNCTION =================================================================
 
#        Name: search
 
# Description: Search packages in AUR
 
# Parameter 1: Keyword to search for
 
# Parameter *: Keywords to search for
 
#==============================================================================
 

	
 
search() {
 

	
 
    msg "Searching AUR for $1"
 
    msg "Searching AUR for $*"
 

	
 
    local url="${AURURL}rpc.php?type=search&arg=$1"
 
    local url="${AURURL}rpc.php?type=search&arg=$*"
 

	
 
    msg_verbose2 "URL is: ${url}"
 

	
...
 
@@ -215,7 +215,7 @@ search() {
 
        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")-1))]}
 
        local category=${CATEGORIES[$(jshon -e CategoryID <<< "$package")]}
 
        local maintainer=$(jshon -e Maintainer <<< "$package")
 
        local last_modified=$(jshon -e LastModified <<< "$package")
 

	
...
 
@@ -436,12 +436,12 @@ download () {
 

	
 
version() {
 

	
 
    printf "Scriptname: $SCRIPTNAME
 
Version: $VERSION
 
Description: $DESCRIPTION
 
Author: $AUTHOR
 
Date of creation: $DATE_OF_CREATION
 
Date of revision: $DATE_OF_REVISION\n"
 
    printf "Scriptname: %s
 
Version: %s
 
Description: %s
 
Author: %s
 
Date of creation: %s
 
Date of revision: %s\n" "$SCRIPTNAME" "$VERSION" "$DESCRIPTION" "$AUTHOR" "$DATE_OF_CREATION" "$DATE_OF_REVISION"
 
}
 

	
 

	
...
 
@@ -452,25 +452,25 @@ Date of revision: $DATE_OF_REVISION\n"
 

	
 
usage() {
 

	
 
    printf "$SCRIPTNAME - $VERSION - $DESCRIPTION
 
    printf "%s - %s - %s
 

	
 
    Download packages from AUR or check installed, foreign packages, if there are updates available.
 

	
 
    Usage:
 
      $SCRIPTNAME <packages>...
 
      $SCRIPTNAME [options] [<packages>]...
 
      %s <packages>...
 
      %s [options] [<packages>]...
 

	
 
    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
 
      -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
 
      -s KEYWORDS, --search KEYWORDS         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
 
      --version                              Print version information and exits
 

	
 
    For complete documentation, run: man 8 yaah\n"
 
    For complete documentation, run: man 8 yaah\n" "$SCRIPTNAME" "$VERSION" "$DESCRIPTION" "$SCRIPTNAME" "$SCRIPTNAME"
 
}
 

	
 

	
0 comments (0 inline, 0 general)