gofind

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 7 Imported by: 0

README

gofind

A simple, efficient tool to search for specific text occurrences within files in a directory. This tool can be used both as a Go package.


Features

  • Traverse directories and search for text in files.
  • Count occurrences of the specified text in all files.
  • Exclude file extensions
  • Simple, lightweight, and easy to integrate.

Installation

As a Go Package

To use this tool in your Go project, install it via:

go get github.com/3cognito/gofind

Import the package into your project:

import "github.com/3cognito/gofind"

Usage

Package Example

Use the tool in your Go code to search for text:

package main

import (
	"fmt"
	"log"
	"github.com/3cognito/gofind"
)

func main() {
	count, err := gofind.CountOccurrences("example.txt", "search_term", ".gitignore,.git")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Occurrences found: %d
", count)
}

This will output the total occurrences of search_term across all files in the specified directory except those with the extensions .gitignore and .git.


Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.


License

This project is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountOccurrences

func CountOccurrences(searchPath, text, exclude string) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL