Subject: | [PATCH] Multiple bugs in -o |
Date: | Fri, 5 Jan 2007 02:56:49 -0500 |
To: | bug-ack [...] rt.cpan.org |
From: | Rick Scott <rick [...] shadowspar.dyndns.org> |
--------------------------------------------------------------------
1: -o takes an argument when it shouldn't.
--------------------------------------------------------------------
According to the docs, -o should show only the matching text, but the
current Getopt::Long config makes it synonymous with --output. So,
ack -a -o Sue t/text/boy-named-sue.txt
gets parsed as output-on-match="Sue", regex="t/text/boy-named-sue.txt",
path-to-search=default to cwd.
Show quoted text
shade> ack -a Sue t/text/boy-named-sue.txt
Was before he left, he went and named me Sue.
I tell ya, life ain't easy for a boy named Sue.
Sat the dirty, mangy dog that named me Sue.
And I said: "My name is Sue! How do you do! Now you gonna die!"
Cause I'm the son-of-a-bitch that named you Sue."
Bill or George! Anything but Sue! I still hate that name!
-- "A Boy Named Sue", Johnny Cash
Show quoted textshade> ack -a -o Sue t/text/boy-named-sue.txt
Sue
Sue
Sue
Sue
Show quoted textshade> grep -o Sue t/text/boy-named-sue.txt
Sue
Sue
Sue
Sue
Sue
Sue
Sue
Show quoted textshade> ack -a t/text/boy-named-sue.txt
t/ack-c.t
30: t/text/boy-named-sue.txt:0
t/ack-v.t
11: t/text/boy-named-sue.txt
32: t/text/boy-named-sue.txt:72
MANIFEST
55:t/text/boy-named-sue.txt
--------------------------------------------------------------------
2: -o suppresses filenames; grep -o does not.
--------------------------------------------------------------------
(As discussed.) Ack should emulate grep and show filenames when
searching with -o unless explicitly suppressed with -h.
Cheers,
Rick
--
key CF8F8A75 / print C5C1 F87D 5056 D2C0 D5CE D58F 970F 04D1 CF8F 8A75
Everyone praises what he believes; his god is his own creature,
and in praising it he praises himself. Consequently he blames
the beliefs of others, which he would not do if he were just,
but his dislike is based on ignorance. :Muid ad-Din ibn al-Arabi
Message body is not shown because sender requested not to inline it.