Gentoo Archives: gentoo-user

From: Andrew Gaydenko <a@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] fast CLI package-Changelog viewer
Date: Mon, 31 Mar 2008 11:35:17
Message-Id: 200803311535.27046@goldspace.net
In Reply to: Re: [gentoo-user] fast CLI package-Changelog viewer by Etaoin Shrdlu
1 ======= On Monday 31 March 2008, Etaoin Shrdlu wrote: =======
2 > On Monday 31 March 2008, 11:31, Andrew Gaydenko wrote:
3 > > I agree, my English is ugly. I'll try to explain. Saying "viewer" I
4 > > mean something like this:
5 > >
6 > > logviewer kdelibs
7 > >
8 > > will "produce" the same output as, say,
9 > >
10 > > less /usr/portage/kde-base/kdelibs/ChangeLog
11 > >
12 > > You see, it is impossible to remember all packages' dirs. Of
13 > > course, I can use 'q' or 'eix' to find a dir and then type in a
14 > > long 'less ...' command. But, well, why do all these 'eix' and 'q'
15 > > exist? I think to save some users' time. Is my intention more clear
16 > > now? :-)
17 >
18 > Neil will surely provide an adequate answer, however, if your needs
19 > aren't too sophisticated, you could put together something like
20 >
21 > $ cat logviewer.sh
22 > #!/bin/bash
23 >
24 > if [ -z "$1" ]; then
25 > echo "Must specify package name!" >&2
26 > exit 1
27 > fi
28 >
29 > p=`eix --only-names -e "$1"`
30 >
31 > if [ -z "$p" ]; then
32 > echo "$1: No matches found" >&2
33 > exit 1
34 > else
35 > howmany=`echo "$p" | wc -l`
36 > if [ "$howmany" -gt 1 ]; then
37 > echo "Many packages with the same name, refine search string:"
38 > >&2 echo "$p" >&2
39 > exit 1
40 > fi
41 > fi
42 >
43 > c="/usr/portage/${p}/ChangeLog"
44 >
45 > if [ -z "$EDITOR" ]; then
46 > EDITOR=`which vi`
47 > fi
48 >
49 > "$EDITOR" "$c"
50 > ---------
51 >
52 > You can also remove the "-e" from the eix line if you want
53 > approximate matching (that will require you to specify the category
54 > almost always though).
55 > Hope this helps.
56
57 Thanks! I definitely must read a bash documentaton :-)
58 --
59 gentoo-user@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-user] fast CLI package-Changelog viewer Justin <justin@×××××××××.net>