Skip to content

freehaha/ignores

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Usage

package main

import (
	"fmt"
	"github.com/freehaha/ignores"
	"os"
	"path/filepath"
)

var ig *ignores.Ignore

func main() {
	ig, _ = ignores.New(".ignore")
	filepath.Walk(".", walkFunc)
}

func walkFunc(path string, info os.FileInfo, err error) error {
	ignore, err := ig.Match(path)
	if err != nil {
		fmt.Printf("err: %s\n", err)
	}
	if ignore {
		if info.IsDir() {
			fmt.Printf("ignored: %s\n", path)
			return filepath.SkipDir
		}
		fmt.Printf("ignored: %s\n", path)
		return nil
	}
	fmt.Printf("path: %s\n", path)
	return nil
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages