add support for absolute path display

116 views
Skip to first unread message

Henning Schild

unread,
Feb 12, 2009, 5:12:24 PM2/12/09
to ack-...@googlegroups.com
Hi,

today I came across ack and I really like it. But it misses a feature
important to me. When filenames are displayed I want to be able to
choose display of absolute paths.

I modified ack and added the -F option to support that. If you have
comments on it please email me.

regards,
Henning

ack-F.patch

Andy Lester

unread,
Feb 12, 2009, 8:31:51 PM2/12/09
to ack-...@googlegroups.com

That seems reasonable. Not sure I'm going to give it a single-
character option, though.

Don't suppose you wrote a test for it?

xoa

--
Andy Lester => an...@petdance.com => www.petdance.com => AIM:petdance

Andy Lester

unread,
Feb 12, 2009, 10:49:38 PM2/12/09
to ack-...@googlegroups.com

On Feb 12, 2009, at 4:12 PM, Henning Schild wrote:

Any comments from other ack users on this idea?

Henning Schild

unread,
Feb 13, 2009, 4:34:06 AM2/13/09
to ack-...@googlegroups.com
My old patch was not working and not nice. I did not write a test for it,
maybe i should have...

On Thu, 12 Feb 2009 23:12:24 +0100
Henning Schild <hen...@wh9.tu-dresden.de> wrote:

> Hi,
>
> today I came across ack and I really like it. But it misses a feature
> important to me. When filenames are displayed I want to be able to
> choose display of absolute paths.
>
> I modified ack and added the -F option to support that. If you have
> comments on it please email me.
>

> regards,
> Henning

ack-F.patch

Michael Hendricks

unread,
Feb 13, 2009, 9:04:04 AM2/13/09
to ack-...@googlegroups.com
On Thu, Feb 12, 2009 at 09:49:38PM -0600, Andy Lester wrote:
> On Feb 12, 2009, at 4:12 PM, Henning Schild wrote:
> > today I came across ack and I really like it. But it misses a
> > feature important to me. When filenames are displayed I want to be
> > able to choose display of absolute paths.
> >
> > I modified ack and added the -F option to support that. If you have
> > comments on it please email me.
>
> Any comments from other ack users on this idea?

I can see how it would be a valuable feature. I agree that it doesn't
deserve a short option though.

--
Michael

Sitaram Chamarty

unread,
Feb 13, 2009, 10:09:25 AM2/13/09
to ack-...@googlegroups.com
On Fri, Feb 13, 2009 at 7:34 PM, Michael Hendricks <mnd...@gmail.com> wrote:

>> > today I came across ack and I really like it. But it misses a
>> > feature important to me. When filenames are displayed I want to be
>> > able to choose display of absolute paths.

then give it an absolute name to start with. Instead of
ack pattern
give it
ack pattern $PWD

And when you're explicitly giving paths, like
ack pattern ../subdir
give it
ack pattern /absolute/path/of/subdir

etc.

>> >
>> > I modified ack and added the -F option to support that. If you have
>> > comments on it please email me.
>>
>> Any comments from other ack users on this idea?
>
> I can see how it would be a valuable feature. I agree that it doesn't
> deserve a short option though.

I agree. I also think this too could be rolled into a printf-style
generic output formatter, along with the other request about column
numbers.

Henning Schild

unread,
Feb 13, 2009, 3:52:40 PM2/13/09
to ack-...@googlegroups.com
Am Fri, 13 Feb 2009 20:39:25 +0530
schrieb Sitaram Chamarty <sita...@gmail.com>:

> then give it an absolute name to start with. Instead of
> ack pattern
> give it
> ack pattern $PWD
>
> And when you're explicitly giving paths, like
> ack pattern ../subdir
> give it
> ack pattern /absolute/path/of/subdir

Thank you for pointing that out, but I already knew that. The reason
for wanting an option is that in can be made default behavior with the
option in ~/.ackrc or an alias.

Henning

Andy Lester

unread,
Feb 13, 2009, 4:05:33 PM2/13/09
to ack-...@googlegroups.com

On Feb 13, 2009, at 2:52 PM, Henning Schild wrote:

> Thank you for pointing that out, but I already knew that. The reason
> for wanting an option is that in can be made default behavior with the
> option in ~/.ackrc or an alias.


I don't see that grep has an option for this. What would you do if
you were doing this with grep? Or would you just punt?

Andy Lester

unread,
Feb 13, 2009, 4:15:47 PM2/13/09
to ack-...@googlegroups.com

On Feb 13, 2009, at 2:52 PM, Henning Schild wrote:

> Thank you for pointing that out, but I already knew that. The reason
> for wanting an option is that in can be made default behavior with the
> option in ~/.ackrc or an alias.


And allowing those options is part of the ack philosophy. To me, the
idea of "Can't you get this functionality by doing this harder thing
that takes longer to type?" is antithetical to ack. Nobody wants to
specify $PWD every time, and you shouldn't have to.

Sitaram Chamarty

unread,
Feb 13, 2009, 8:12:26 PM2/13/09
to ack-...@googlegroups.com
On Sat, Feb 14, 2009 at 2:22 AM, Henning Schild
<hen...@wh9.tu-dresden.de> wrote:

> Thank you for pointing that out, but I already knew that. The reason

My apologies -- I didn't mean it to sound whatever it apparently sounded like.

Sitaram Chamarty

unread,
Feb 13, 2009, 8:15:08 PM2/13/09
to ack-...@googlegroups.com
On Sat, Feb 14, 2009 at 2:45 AM, Andy Lester <an...@petdance.com> wrote:

> And allowing those options is part of the ack philosophy. To me, the
> idea of "Can't you get this functionality by doing this harder thing
> that takes longer to type?" is antithetical to ack. Nobody wants to
> specify $PWD every time, and you shouldn't have to.

And yet I would consider column numbers to be even more
important/useful, but you preferred a printf-style thing for that a
few emails ago...

I was trying to be consistent with what *you* said, ironically.

Henning Schild

unread,
Feb 13, 2009, 8:29:52 PM2/13/09
to ack-...@googlegroups.com
On Fri, 13 Feb 2009 15:05:33 -0600
Andy Lester <an...@petdance.com> wrote:

> I don't see that grep has an option for this. What would you do if
> you were doing this with grep? Or would you just punt?

Punt or use a script for it.

Henning

Andy Lester

unread,
Feb 13, 2009, 10:01:41 PM2/13/09
to ack-...@googlegroups.com

On Feb 13, 2009, at 7:15 PM, Sitaram Chamarty wrote:

> And yet I would consider column numbers to be even more
> important/useful, but you preferred a printf-style thing for that a
> few emails ago...
>
> I was trying to be consistent with what *you* said, ironically.


No, I agree, an ACK_FORMAT string would be great. Everyone could make
their own and stick it in their /etc/ackrc files and the world would
be a fabulous place.

Thore

unread,
May 24, 2012, 12:38:36 PM5/24/12
to ack-...@googlegroups.com

Am Freitag, 13. Februar 2009 04:49:38 UTC+1 schrieb Andy Lester:

Any comments from other ack users on this idea?


 
Sorry for bump this old thread but I'm also looking for a way to display full paths whenever file names are displayed in ack. Is there a solution in 1.96 or will there be one in the future?

Thanks

Andy Lester

unread,
May 24, 2012, 12:41:29 PM5/24/12
to ack-...@googlegroups.com

On May 24, 2012, at 11:38 AM, Thore wrote:

Sorry for bump this old thread but I'm also looking for a way to display full paths whenever file names are displayed in ack. Is there a solution in 1.96 or will there be one in the future?

I don't have any plans to put such a thing in, but, have you tried having your starting directory have the fullpath?

If you're doing "ack foo", do "ack foo `pwd`".  If you're doing "ack foo lib", do "ack foo /home/user/project/lib".
Reply all
Reply to author
Forward
0 new messages