You are not logged in.

After browsing around this board for a while, I came across a program named iwant, (https://bbs.archlinux.org/viewtopic.php?id=95930) and since i sorta liked it, I decided to make my own clone, since I can't write in ruby, and it had absolutly no support for the AUR. So after about 2 weeks, I made this bash script.
It requires the coreutils, pacman-color (if using the default pkgman var), cower (if using default vars), and english. :-)
To install packages with it, just say something like:
$ i want packagehere
To specify multiple packages to install, say something like:
$ i want package1, package2, package3, and package4
To search for packages, do:
$ i want to find query
To remove packages:
$ i dont want package
To specify multiple, do it the same way, but prefix with 'dont want' (if only I could make don't want possible) ;-D
To upgrade the system (pacman -Syu):
$ i want to upgrade
To update the package lists:
$ i want to update
To do --noconfirm:
$ noconfirm=1 i (whatever)
So, report bugs n' stuff here. I wouldn't mind some more ideas too ;-)
Update Log:
0.2 - Added noconfirm abilities.
0.1 - Initial Release
#!/bin/bash
# i - a miniscule interface to the aur
# created by hunterm <hunterm.haxxr@gmail.com>
# inspired by iwant (https://bbs.archlinux.org/viewtopic.php?id=95930)
# REQUIREMENTS:
# sudo
# coreutils - grep, sed, fileutils, etc.
# pacman-color (if using default pkgman variable)
# bash, of course
# cower - if using default aurget and aurfin vars
#
# ex. $ i want pacman
# ex. $ i dont want pacman
pkgman='pacman-color' # change to whatever
abs="$HOME/abs" # change to your favorite place to download the packages
aurget="cower -cdf -t $abs" # change to your favorite taurball downloader, must
                             # must accept "${package}" as the second argument.
aurfin="cower -cs" # must accept "${query}" as second arg
aurupg="cower -uq" # must print out only the names of packages that need to be upgraded.
makepkg="makepkg -fis" # what command to make the package with
# you shouldn't need to edit below this line
# ------------------------------------------------------------------------------
# color codes, shamelessly ripped off of the arch wiki
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
unkblk='\e[4;30m' # Black - Underline
undred='\e[4;31m' # Red
undgrn='\e[4;32m' # Green
undylw='\e[4;33m' # Yellow
undblu='\e[4;34m' # Blue
undpur='\e[4;35m' # Purple
undcyn='\e[4;36m' # Cyan
undwht='\e[4;37m' # White
bakblk='\e[40m'   # Black - Background
bakred='\e[41m'   # Red
badgrn='\e[42m'   # Green
bakylw='\e[43m'   # Yellow
bakblu='\e[44m'   # Blue
bakpur='\e[45m'   # Purple
bakcyn='\e[46m'   # Cyan
bakwht='\e[47m'   # White
txtrst='\e[0m'    # Text Reset
function consume() {
# thanks to Svm/Wintervenom, for the awesome pacman function
# colors, variabilization, and drop-to-shell functionality added by hunterm
    if [[ "$*" == '' ]];then
        echo -e "${bldred}error:${txtrst} no target specified"
        return 1
    fi
    for package in $@; do
        echo -en "Looking for $bldred'$package'$txtrst in the$bldgrn package repos$txtrst... "
        # This is faster than attempting an install if a package isn't in the repos.
        result=$($pkgman -Sqs "^${package}$" | grep -m1 "^${package}$")
        if [[ "$result" ]]; then
            echo 'Found.'
            [[ -z "${noconfirm}" ]] && echo -e -n "${bldylw}-->$bldwht Install [Y/Enter],$bldgrn Search AUR [A],$bldred Cancel [^C]: " && read -n1 feedback
            echo
            [[ -z "${feedback}" || "${feedback}" == 'y' ]] &&
                sudo $pkgman -S ${package}
        else
            echo 'Not found.'
        fi
        if [[ -z "${result}" || "${feedback}" == 'a' ]]; then
            echo -e "Looking for $bldred'${package}'$txtrst in the$bldgrn AUR$txtrst..."
                echo 'Build exists.'
            if [[ -d "${HOME}/abs/${package}" ]]; then
                [[ -z "${noconfirm}" ]] && echo -en "${bldylw}--> ${bldgrn}Overwrite [Y/Enter] or$bldred Continue [N]: " && read -n1 feedback
                echo
                [[ "${feedback}" && "${feedback}" != 'y' ]] &&
                    continue
            fi
            echo -e "${bldwht}Downloading Package..."
            $aurget "${package}"
            cd $abs/${package} &>/dev/null || echo -e "${bldred}Package's directory could not be changed to.\nCheck the output above for information, this package might not be in the AUR."
            echo "List of files:"
            env ls -1 | grep .
            if [[ "$noconfirm" == "1" ]];then
                echo -n ''
            else
                echo -ne "${bldylw}-->${bldgrn} Drop into shell [s],$bldwht Install [Y/Enter],$bldred Cancel [^C]: "
                read -e -n1 feedback
            fi
            if [[ -z "${feedback}" || "${feedback}" == 'y' ]];then
                if [[ "$noconfirm" == "1" ]];then
                    $makepkg --noconfirm
                else
                    $makepkg
                fi
            fi
            if [[ "${feedback}" == 's' ]];then
                echo "remember to exit when done."
                echo 'hint: type $EDITOR PKGBUILD to edit the PKGBUILD'
                echo 'type $EDITOR *.install to edit the install file'
                bash
                if [[ "$noconfirm" == "1" ]];then
                    $makepkg --noconfirm
                else
                    $makepkg
                fi
            fi
        fi
    done
}
if [[ -z "$*" ]];then
    echo -e "${bldwht}what do you want?${txtrst}"
    echo -e "${bldblu}i - a simple aur frontend${txtrst}"
    echo -e "i want package - downloads and installs package"
    echo -e "i dont want package - removes package"
    echo -e "i want to find package - search for query"
    echo -e "i need help - display help message"
    echo -e "created by hunterm <hunterm.haxxr@gmail.com>"
    exit 1
fi
if [[ "$*" == "want to find" ]];then
    echo -e "${bldred}error${txtrst}: no query given"
    exit 1
elif [[ "$*" == "need to find" ]];then
    echo -e "${bldred}error${txtrst}: no query given"
    exit 1
elif [[ "$*" == "need" ]];then
    echo -e "${bldred}error${txtrst}: no operation given"
    exit 1
elif [[ "$*" == "want" ]];then
    echo -e "${bldred}error${txtrst}: no operation given"
    exit 1
elif [[ "$*" == "need to" ]];then
    echo -e "${bldred}error${txtrst}: no operation given"
    exit 1
elif [[ "$*" == "want to" ]];then
    echo -e "${bldred}error${txtrst}: no operation given"
    exit 1
fi
if [[ -n "$1" ]];then
    case "$1" in
    "-h"|"--help"|"-help")
    echo -e "${bldwht}what do you want?${txtrst}"
    echo -e "${bldblu}i - a simple aur frontend${txtrst}"
    echo -e "i want package - downloads and installs package"
    echo -e "i dont want package - removes package"
    echo -e "i want to find package - search for query"
    echo -e "i need help - display help message"
    echo -e "created by hunterm <hunterm.haxxr@gmail.com>"
    ;;
    "want")
#    trap "echo Interrupt signal recieved; exit" 2
    if [[ "$2" == "to" ]];then # incase
        if [[ "$3" == "upgrade" ]];then
            echo -e "${bldwht}Upgrading Packages..."
            pacman='consume'
            if [[ "$noconfirm" == '1' ]];then
                sudo $pkgman -Su --noconfirm
            else
                sudo $pkgman -Su
            fi
            $pacman `$aurupg`
            exit
        fi
        if [[ "$3" == "update" ]];then
            echo -e "${bldwht}Updating package lists..."
            if [[ "$noconfirm" == '1' ]];then
                sudo $pkgman -Sy --noconfirm
            else
                sudo $pkgman -Sy
            fi
            exit
        fi
        query=`echo $* | sed -e "s/$1//" -e "s/$2//" -e "s/  find //" -e "s/to//"`
        $pkgman -Ss "${query}" # a package
        $aurfin "${query}"
        exit
    fi
    packages=`echo $* | sed "s/$1//"`
    packages=`echo $packages | sed -e 's/,/ /g' -e '/\band\b/d'`
    pacman='consume'
    $pacman $packages
    ;;
    "dont")
    trap "echo Interrupt signal recieved; exit" 2
    packages=`echo $* | sed -e "s/$1//" -e "s/$2//"` # in the case of 'dont want'
    packages=`echo $packages | sed -e 's/,/ /g' -e '/\band\b/d'`
    if [[ "$noconfirm" == '1' ]];then
        pacman="sudo $pkgman --noconfirm -R"
    else
        pacman="sudo $pkgman -R"
    fi
    $pacman $packages
    ;;
    "need")
    trap "echo Interrupt signal recieved; exit" 2
    if [[ "$2" == "help" ]];then
        echo -e "${bldwht}what do you want?${txtrst}"
        echo -e "${bldblu}i - a simple aur frontend${txtrst}"
        echo -e "i want package - downloads and installs package"
        echo -e "i dont want package - removes package"
        echo -e "i want to find package - search for query"
        echo -e "i need help - display help message"
        echo -e "created by hunterm <hunterm.haxxr@gmail.com>"
        exit 1
    fi
    if [[ "$2" == "to" ]];then # incase
        if [[ "$3" == "upgrade" ]];then
            echo -e "${bldwht}Upgrading Packages..."
            if [[ "$noconfirm" == '1' ]];then
                sudo $pkgman -Su --noconfirm
            else
                sudo $pkgman -Su
            fi
            pacman='consume'
            $pacman `$aurupg`
            exit
        fi
        if [[ "$3" == "update" ]];then
            echo -e "${bldwht}Updating package lists..."
            if [[ "$noconfirm" == '1' ]];then
                sudo $pkgman -Sy --noconfirm
            else
                sudo $pkgman -Sy
            fi
            exit
        fi
        query=`echo $* | sed -e "s/$1//" -e "s/$2//" -e "s/  find //" -e "s/to//"`
        $pkgman -Ss "${query}" # a package
        $aurfin "${query}"
        exit
    fi
    packages=`echo $* | sed "s/$1//"`
    packages=`echo $packages | sed -e 's/,/ /g' -e '/\band\b/d'`
    pacman='consume'
    $pacman $packages
    ;;
    *)
    echo "what do you want?"
    echo "if you need help, do"
    echo "$ i need help"
    ;;
    esac
fiLast edited by hunterm (2010-11-28 07:11:17)
Offline

I like the idea. It is kind of cute.
Arch x64 on Thinkpad X200s/W530
Offline

I'd like to see a more polite language.
I'd really like to see foo, purdy please.
Are there any new packages, my dear?
Offline

I want to know who first came up with this idea.
I want cherries with that.
Interesting, but I think I'll stick with pacman 
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline

i wonder if there's a ghetto version: sup dawg, i heard you like pacman, so i put a package in your package so you can install while you install
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline

Lol. Perhaps nice for 5 minutes...
There's a reason why unmount is called umount...
Offline

There's a reason why unmount is called umount...
If you're one of those programmers that leaves out a single character to make something shorter and look less like a normal word, I hate you.
Correction: If *anyone's*... 
Last edited by drcouzelis (2010-11-28 23:22:59)
Offline
I'd like to see a more polite language.
YOU MENA INTERCAL?
INTERCAL has many other features designed to make it even more aesthetically unpleasing to the programmer: it uses statements such as "READ OUT", "IGNORE", "FORGET", and modifiers such as "PLEASE". This last keyword provides two reasons for the program's rejection by the compiler: if "PLEASE" does not appear often enough, the program is considered insufficiently polite, and the error message says this; if too often, the program could be rejected as excessively polite. Although this feature existed in the original INTERCAL compiler, it was undocumented.[5]
Offline

How 'bout instead of "noconfirm=1" you do something like "dont ask me again but". 
Offline

or even "noconfirm=1" is "really". I really want cowsay
Cute, yes, but at least for me this would get old fast.
Nai haryuvalyë melwa rë
Offline

Lol. Perhaps nice for 5 minutes...
There's a reason why unmount is called umount...
...and what is that reason? If list is 'ls' and copy is 'cp' why wouldn't unmount be 'umnt' or just plain 'unmount'?
Offline

In Plan9 it's unmount.
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline

I have a suggestion about noconfirms - I use pacman in the way that downloads packages first, without confirmation, but then proceeds with the install without --noconfirm. That way I still get a chance to resolve any issues that might rise:
if ARGV[0] == 'sync'
    system "sudo powerpill -Syuw --noconfirm"  #downloads packages without confirmation
    system "sudo pacman -Su"                   #installs updates, asking for confirmation
elsif ARGV[0] != nil
    retval = system "sudo powerpill -Sw --noconfirm #{ARGV.join(' ')}"
    system "sudo pacman -S #{ARGV.join(' ')}" if retval
else
    puts 'What?'
endOf course, one would need a timeout on sudo, or NOPASSWD set.
Last edited by JezdziecBezNicka (2010-11-30 16:57:12)
This is my signature. If you want to read it, first you need to agree to the EULA.
Offline