0 1 0
default
Dennis Fink (metalgamer) - 3 years ago 2016-03-09 00:37:52
dennis.fink@c3l.lu
Added exact name search
1 file changed with 12 insertions and 0 deletions:
12
↑ Collapse Diff ↑
...
 
@@ -9,6 +9,7 @@
9 9
 
#:               -d DIRECTORY, --downloaddir DIRECTORY   Download packages to the specified directory
10 10
 
#:               -s KEYWORD, --search KEYWORD            Search for packages containing specified keyword
11 11
 
#:               -s MAINTAINER, --maintainer MAINTAINER  Search for packages from specified maintainer
12
 
#:               -n NAME, --name NAME                    Search for packages by exact name
12 13
 
#:               -g, --git                               Use git to download packages
13 14
 
#:               -v, --verbose                           Be more verbose, can be supplied at  maximum 2 times
14 15
 
#:               -q, --quiet                             Be less verbose. Takes precedence over -v and --verbose
...
 
@@ -168,6 +169,9 @@ search() {
168 169
 
    if [[ "$type" == "msearch" ]]; then
169 170
 
        msg "Searching AUR for packages by maintainer $1"
170 171
 
        type="search&search_by=maintainer"
172
 
    elif [[ "$type" == "nsearch" ]]; then
173
 
        msg "Searching AUR for packages by exact name $1"
174
 
        type="search&search_by=name"
171 175
 
    else
172 176
 
        msg "Searching AUR for $1"
173 177
 
    fi
...
 
@@ -460,6 +464,7 @@ usage() {
460 464
 
      -d DIRECTORY, --downloaddir DIRECTORY   Download packages to the specified directory
461 465
 
      -s KEYWORDS, --search KEYWORDS          Search for packages containing specified keywords
462 466
 
      -m MAINTAINER, --maintainer MAINTAINER  Search packages from specified maintainer
467
 
      -n NAME, --name NAME                    Search packages by exact name
463 468
 
      -g, --git                               Download packages using git
464 469
 
      -v, --verbose                           Be more verbose, can be supplied at  maximum 2 times
465 470
 
      -q, --quiet                             Be less verbose. Takes precedence over -v and --verbose
...
 
@@ -472,6 +477,7 @@ usage() {
472 477
 
check_flag=
473 478
 
search_flag=
474 479
 
maintainer_flag=
480
 
name_flag=
475 481
 
parseable_flag=
476 482
 
git_flag=0
477 483
 
verbose=0
...
 
@@ -524,6 +530,10 @@ while true; do
524 530
 
            maintainer_flag=1
525 531
 
            shift
526 532
 
            ;;
533
 
        -n|--name)
534
 
            name_flag=1
535
 
            shift
536
 
            ;;
527 537
 
        -p|--parseable)
528 538
 
            check_flag=1
529 539
 
            parseable_flag=1
...
 
@@ -572,6 +582,8 @@ elif [[ "$search_flag" ]]; then
572 582
 
    search "search" "$@"
573 583
 
elif [[ "$maintainer_flag" ]]; then
574 584
 
    search "msearch" "$@"
585
 
elif [[ "$name_flag" ]]; then
586
 
    search "nsearch" "$@"
575 587
 
else
576 588
 
    download "$@"
577 589
 
fi
0 comments (0 inline, 0 general)