Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add function declaration search flag #211

Closed
ericandrewlewis opened this Issue · 2 comments

2 participants

@ericandrewlewis

To search for a function declaration, you would do something like this:

ack "function myfunction("

As function definitions share the same syntax mostly across languages, perhaps we could simplify this into an option in ack search? so that you could do something like

ack --function myfunction

Of course the option could be something shorter, just a start for discussion.

@petdance
Owner

What's the use case for this? Only wanting to find the one place a given function was declared? Like

ack --function write_record

and then the single hit would come back

records.pm:47:    sub write_record {

Is that a big enough win to make it better than

ack '^sub write_record'

?

Not arguing. Trying to understand.

@ericandrewlewis

Yeah it's debatable.

I used a custom shell command to do my searching through WordPress core before using ack, and I just prefer the ease of syntax to add a one letter option rather than spelling out "function function_name" as a parameter

@petdance petdance closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.