1 |
On Monday 31 March 2008, 11:31, Andrew Gaydenko wrote: |
2 |
|
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 course, I |
13 |
> can use 'q' or 'eix' to find a dir and then type in a long 'less ...' |
14 |
> command. But, well, why do all these 'eix' and 'q' exist? I think to |
15 |
> save some users' time. Is my intention more clear now? :-) |
16 |
|
17 |
Neil will surely provide an adequate answer, however, if your needs |
18 |
aren't too sophisticated, you could put together something like |
19 |
|
20 |
$ cat logviewer.sh |
21 |
#!/bin/bash |
22 |
|
23 |
if [ -z "$1" ]; then |
24 |
echo "Must specify package name!" >&2 |
25 |
exit 1 |
26 |
fi |
27 |
|
28 |
p=`eix --only-names -e "$1"` |
29 |
|
30 |
if [ -z "$p" ]; then |
31 |
echo "$1: No matches found" >&2 |
32 |
exit 1 |
33 |
else |
34 |
howmany=`echo "$p" | wc -l` |
35 |
if [ "$howmany" -gt 1 ]; then |
36 |
echo "Many packages with the same name, refine search string:" >&2 |
37 |
echo "$p" >&2 |
38 |
exit 1 |
39 |
fi |
40 |
fi |
41 |
|
42 |
c="/usr/portage/${p}/ChangeLog" |
43 |
|
44 |
if [ -z "$EDITOR" ]; then |
45 |
EDITOR=`which vi` |
46 |
fi |
47 |
|
48 |
"$EDITOR" "$c" |
49 |
--------- |
50 |
|
51 |
You can also remove the "-e" from the eix line if you want approximate |
52 |
matching (that will require you to specify the category almost always |
53 |
though). |
54 |
Hope this helps. |
55 |
-- |
56 |
gentoo-user@l.g.o mailing list |