diff --git a/README.md b/README.md index a8d0ed5..530e997 100644 --- a/README.md +++ b/README.md @@ -112,27 +112,20 @@ package main import ( "fmt" - "log" "github.com/Moderrek/lines/pkg/lines" ) func main() { - // Configure the counter with default settings. - config := lines.Config{ - IncludeHidden: false, - } - counter := lines.NewCounter(config) + counter := lines.NewCounter(lines.Config{}) - // Run the analysis on the current directory. - result, err := counter.Run(".") + result, err := counter.Run([]string{"."}) if err != nil { - log.Fatalf("Analysis failed: %v", err) + fmt.Printf("error: %v\n", err) } - // Print results. for ext, count := range result.LinesByExtension { - fmt.Printf("Extension: %s, Lines: %d\n", ext, count) + fmt.Printf("ext: %s\tlines: %d\n", ext, count) } } ``` @@ -145,10 +138,12 @@ You can customize which directories and file extensions to ignore: config := lines.Config{ IncludeHidden: false, IgnoredDirs: lines.IgnoredDirSet("node_modules", ".git"), - IgnoredExtensions: lines.IgnoredExtensionSet("exe", ".env"), + IgnoredExtensions: lines.IgnoredExtensionSet("exe", "env"), + NumWorkers: 4, + Verbose: true, } counter := lines.NewCounter(config) -result, err := counter.Run("./src") +result, err := counter.Run([]string{"./src"}) ``` If `IgnoredDirs` or `IgnoredExtensions` are not provided, the library uses sensible defaults. The helper functions above are optional, but they make the config easier to read.