Ben Bullock

NAME

Parse::Gitignore - parse .gitignore files

SYNOPSIS

produces output

(This example is included as synopsis.pl in the distribution.)

VERSION

This documents Parse::Gitignore version 0.04 corresponding to git commit eef29c685b26d8cd9b28ff74e5e2388e751fd23e released on Mon Oct 9 14:00:13 2017 +0900.

DESCRIPTION

Parse a .gitignore file and check whether a file matches it.

METHODS

new

    my $pg = Parse::Gitignore->new ('./.gitignore');

ignored

    if ($pg->ignored ('./Makefile')) {
        print "Makefile is ignored.\n";
    }

Check whether a file matches a .gitignore.

read_gitignore

    $pg->read_gitignore ('.gitignore');

Read a .gitignore file. You can read as many as you like and they are accumulated.

excludesfile

    $pg->excludesfile ('/home/user/.gitignore');

Read an excludesfile which is applied to all directories where .git is found.

DEPENDENCIES

Path::Tiny

HISTORY

I wrote this because I wanted to have a way to ignore generated files for a desktop file search application.

AUTHOR

Ben Bullock, <bkb@cpan.org>

COPYRIGHT & LICENCE

This package and associated files are copyright (C) 2016-2017 Ben Bullock.

You can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence.