Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function declaration search flag #211

Closed
ericandrewlewis opened this issue Feb 22, 2012 · 2 comments
Closed

Add function declaration search flag #211

ericandrewlewis opened this issue Feb 22, 2012 · 2 comments

Comments

@ericandrewlewis
Copy link

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
Copy link
Collaborator

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants