summaryrefslogtreecommitdiff
path: root/.zsh/functions/open_ebuild
blob: dedecb36e77066cff6af1607f69481c0df6c7e39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Open the ebuild with a specified command
local ebuild sel
local -a elist

if [[ $# -lt 2 ]]; then
    echo "No package name given."
    return 4
fi

ebuild="$(equery w $2 2>&1 )"
if [[ $? -ne 0 ]]; then
    if [[ $ebuild == *"Ambiguous"* ]]; then
        elist=(${(f)ebuild})
        
        # remove the first line
        shift elist

        echo "Ambiguous package name '$2' -- choose from: "
        cat -n <<< ${(F)elist}
        read "sel?Selection: "
        
        if [[ -z $elist[$sel] ]]; then
            echo "Invalid choice."
            return 1
        else
            # the "=" is needed to strip the leading spaces and the quotes
            open_ebuild $1 ${=elist[$sel]}
            return $?
        fi
    
    elif [[ $ebuild == *"No packages matching"* ]]; then
        echo "Trying masked packages too..."
        ebuild=$(equery  w -m $2 2>&1)
    fi
fi

if [[ $? -eq 0 ]]; then
    $1 $ebuild
else
    echo "No ebuild found"
fi

# vim: ft=zsh
966dab0f1c2ebd7145ac9&follow=1'>Use debug mode for testingRené 'Necoro' Neumann1-1/+1 2016-03-25Add mail to the dependenciesRené 'Necoro' Neumann1-0/+1 2015-06-09itemtomail: embed images using data: URLsHEADmasterAntonio Terceiro1-18/+2 2015-05-10Bump versionAntonio Terceiro1-1/+1 2015-05-10Fix regression in `include-images` optionAntonio Terceiro3-8/+16 2015-05-03Bump versionAntonio Terceiro1-1/+1 2015-05-03Fix usage of filtersAntonio Terceiro2-16/+24 2015-01-13Handle being given numbers as feed nameAntonio Terceiro2-0/+16 2015-01-13Rakefile: remove wrong (and thus unused) flagAntonio Terceiro1-1/+0 2015-01-13Remove deprecated 'test suite' fileAntonio Terceiro1-12/+0 2015-01-13Rakefile: re-indentAntonio Terceiro1-35/+35 2015-01-13Rakefile: run tests in verbose modeAntonio Terceiro1-1/+2 2014-10-071.2.3 releaseAntonio Terceiro1-1/+1 2014-10-07Fix cleanup of maildirsAntonio Terceiro3-1/+16 2014-05-18feed2imap-test: reuse cache dir/protect configAntonio Terceiro1-1/+1 2014-02-13feed2imap-test: can now take a feed URL as argumentAntonio Terceiro1-3/+22 2014-02-13update .gitignoreAntonio Terceiro1-0/+2 2014-02-13fix dependency on ruby-feedparserAntonio Terceiro1-1/+1 2014-02-05Release 1.2.2Antonio Terceiro2-2/+2 2014-02-05config: fix regression with arrays as targetAntonio Terceiro2-1/+17 2013-08-28Fix teardown method nameAntonio Terceiro1-1/+1