diff --git a/README.md b/README.md index 104779b..2629b8b 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ If you just want to list the files that porto would change vanity import, run: ```bash porto -l path/to/library ``` + ## Inclusion/exclusion rules `porto` skips autogenerated, internal, third party and vendored files by default. You can customize what files get included using some flags: @@ -38,13 +39,22 @@ porto -l path/to/library ```bash porto --skip-files ".*\\.pb\\.go$" path/to/library ``` + - If you want to ignore directories (e.g. tooling directories), pass the `--skip-dirs` flag: ```bash porto --skip-dirs "^tools$" path/to/library ``` + - If you want to include `internal` folders and directories skipped by default: ```bash porto --include-internal --skip-dirs-use-default=false path/to/library ``` + +- If you want to restrict to certain files e.g. `doc.go` you +can use: + +```bash +porto --restrict-to-files "doc.go$" path/to/library +``` diff --git a/cmd/porto/main.go b/cmd/porto/main.go index e2a4a81..25a961e 100644 --- a/cmd/porto/main.go +++ b/cmd/porto/main.go @@ -18,7 +18,7 @@ func main() { flagSkipDirs := flag.String("skip-dirs", "", "Regexps of directories to skip") flagSkipDefaultDirs := flag.Bool("skip-dirs-use-default", true, "Use default skip directory list") flagIncludeInternal := flag.Bool("include-internal", false, "Include internal folders") - restrictToFiles := flag.String("restrict-to-files", "", "Regexps of files to restrict the inspection on. It takes precedence over -skip-files and -skip-dirs") + flagRestrictToFiles := flag.String("restrict-to-files", "", "Regexps of files to restrict the inspection on. It takes precedence over -skip-files and -skip-dirs") flag.Parse() baseDir := flag.Arg(0) @@ -49,7 +49,7 @@ Add import path to a folder log.Fatalf("failed to build files regexes to exclude: %v", err) } - restrictToFilesRegex, err := porto.GetRegexpList(*restrictToFiles) + restrictToFilesRegex, err := porto.GetRegexpList(*flagRestrictToFiles) if err != nil { log.Fatalf("failed to build files regexes to include: %v", err) }