Code Monkey home page Code Monkey logo

ack2's Introduction

Build status of dev branch

ack 2

ack is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code. It runs in pure Perl, is highly portable, and runs on any platform that runs Perl.

ack is written and maintained by Andy Lester ([email protected]).

Building

ack requires Perl 5.8.8 or higher. Perl 5.8.8 was released January 2006.

# Required
perl Makefile.PL
make
make test
sudo make install # for a system-wide installation (recommended)
# - or -
make ack-standalone
cp ack-standalone ~/bin/ack2 # for a personal installation

Development

Developer's Guide

Design Guide

ack2's People

Contributors

achamberlin-lendup avatar andrewblack avatar dolmen avatar epa avatar errorific avatar frasertweedale avatar hoelzro avatar ispedals avatar jgbishop avatar jwilk avatar karenetheridge avatar knowledgejunkie avatar leonardehrenfried avatar leonidas-from-xiv avatar madsen avatar mingwandroid avatar mmcclimon avatar mrshu avatar nschum avatar oeuftete avatar pdl avatar petdance avatar raulgundin avatar rconradharris avatar rkbodenner avatar shlomif avatar sjaeckel avatar sth avatar varadinsky avatar wchristian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ack2's Issues

Add a --only-known option

ack 1.x's behavior was to only search known files. ack 2.0 will make this not be the case. For people who like the 1.x way, make an --only-known option, especially for putting in your ~/.ackrc

I'm not set on the name, but we need the functionality.

Add a --files-from option

Normally, ack gets its list of files to search from ARGV. This feature would allows uses to specify a file containing one filename per line that specifies the list of files.

squash doesn't let variables initialize themselves properly

If you write the following in Ack.pm:

{
my $first_time = 1;

sub call_func {
  if($first_time) {
    $first_time = 0;
  } else {
    print "again\n";
  }
}

}

and call call_func, you would probably expect no output from ack, but you'd be wrong. Squash puts .pm files after the call to main(), so variables initialized inline never get initialized. We either need to warn the developer if they make this mistake (and recommend they initialize their variable in a BEGIN block), or fix squash.

Never include an ackrc file twice

If you're operating under a descendant of your home directory, and you have no project ackrc, ack2 will use $HOME/.ackrc for your project file as well as your user file. This results in $HOME/.ackrc being loaded twice.

Option to pack default ackrc into script

I use ack on a lot of different machines, so I think that having the option to have a default ackrc "compiled into" might be nice to ease distribution. Maybe even have an option for this, like:

ack --pack-ackrc=my-ackrc

Thoughts?

App::Ack::Resource::Basic attempts to open directories for reading with open()

When I try to search my source tree, I get the following error:

$ ack2 -l FOO
ack: .git: Permission denied
Can't call method "name" on an undefined value at d:/git/ack2/ack line 1247.

I was able to trace this back to App::Ack::Resource::Basic line 37, which attempts to open the file it's been passed for reading. If this file is a directory, then this attempt fails (yielding the "Permission denied" error) and the method returns no object (which explains the "Can't call method on undefined value" error immediately afterward). If I make a local modification to the module so line 37 reads

if ((! -d $self->{filename}) && !open( $self->{fh}, '<', $self->{filename} ) ) {

then I get the following output:

$ ack2 -l FOO
Doxyfile
lib/GA/MiddleTier/Ops/Sync/WizardData/Mssql.pm

Allow AND composition of filters

Currently, when I run the following:

ack --perl --ruby $awesome_stuff $the_internet

ack interprets this as (search all Perl and Ruby files in $the_internet for $awesome_stuff). So it means Perl OR Ruby. I was thinking about implementing #35 (and my extended idea in #34) as a filter; however, for that to work properly, I would need a way to say --mtime AND --perl, or --dirty AND --ruby.

Allow --ignore-dir to be more flexible

The --ignore-dir option currently only supports direct matches (ex. --ignore-dir=is,extlib; --ignore-dir=extlib is just shorthand for that). In the future, it'd be nice to allow more complex match types.

Allow other dump types

Specifying --dump currently dumps out the options loaded from config files. It'd be nice if we had other --dump types (which makes me want to rename this option to --debug), such as:

  • Filters - show a representation of which filters are selected by the other options on the command line.
  • Filter Step - allow you to step through the execution of ack (like a debugger), and see the effect of each filter on each resource.

Tests fail if TMPDIR is set and is a subdirectory of HOME

I'm getting this test failure:

t/config-finder.t .......... 1/21 
#   Failed test at t/config-finder.t line 69.
#     Structures begin differing at:
#          $got->[1] = '/home/shlomif/.ackrc'
#     $expected->[1] = Does not exist
# Looks like you failed 1 test of 21.

The problem is in App::Ack::ConfigFinder that also searches all upper directories for .ackrc files and list them and I have an .ackrc in my home directory.

How do we install ackrc?

  • Define the rules for placement of /etc/ackrc on all platforms
  • CPAN installer has to install /etc/ackrc
  • ack --install-ackrc

Add --type to ack2

In ack 1.x, I can write the following:

ack --type=perl -f # means the same as ack --perl -f

This doesn't currently exist in ack2, so we need to add it.

Only allow --noenv on the command line

Allowing --noenv in a .ackrc file will cause crazy results. We have to check for --noenv before we go looking in the environment or the filesystem, and if we see it, that's an error.

Potential gotcha in types: How do we handle the R language?

Ben ([email protected]) emailed me about adding support for R in ack. I said I wasn't going to add anything to ack 1.x, but this sort of type handling is something we need to be aware of going forward. We already have C as --cc, but what will we do with R? D?

hello --

thanks for the great product.

1) i think R is being used enough to deserve a type in ack.  i think
.R is a common extension for it.

2) in a related note, i had

--type-set=R=.R

in my .ackrc but it didn't work.  i looked at the source and
discovered that this is because ack down-cases the file extensions
before comparing with the known extensions.  hence any extension
that is not all lowercase will never match.  changing it to

--type-set=R=.r

fixed it.  this is a little confusing for people who are used to
upper case extensions (as with R.)  as such i propose that ack
automatically internally down-case any extension specified by a
--type-set or --type-add, to prevent confusing users.

just my 2 cents.

best,
ben

Check "option coverage"

run_ack and friends from Util.pm are how we run ack in a test environment, so these functions have access to all the options we actually test. It'd be smart to create a summary of which options are used, so we can verify that we're testing the program's functionality properly.

Write a glossary

Many terms thrown around, need to understand them all

  • "filetype"
  • "resource"
  • "rule"
  • "selection"

Allow "parameterized" filter types

In #35, it is proposed to add an --mtime option to ack. I think this is a great idea; in fact, I feel like the filter system built into ack2 is perfect for the job. That way, I could create the mtime filter in my ackrc, like so:

--type-add=mtime,command,find . -mtime $n_days

However, where does $n_days come from? I shouldn't have to hardcode this in the config file; otherwise I'd need --mtime1, --mtime5, --mtime10, etc. It'd be nice if you could just say --mtime=10, so I think the filter system should support this.

Allow matches to ding the bell on the terminal

I think it might be nice to allow --passthru to throw a bell character into the match. Let's say I'm tailing a log file, and I want to highlight the string "Job's done":

tail -f /var/log/warcraft/peasant.log | ack --passthru --color "Job's Done"

If I expect that job to take a while, I may only check it every few minutes. However, if ack had the ability to throw a bell character into the match coloration, I would hear a bell every time that pattern is matched, and I would know to check that log file again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.