()
| 21 | var Excludes []string |
| 22 | |
| 23 | func main() { |
| 24 | var path string |
| 25 | var recurse bool |
| 26 | var excl string |
| 27 | |
| 28 | parse.LanguageSupport.OpenStandard() |
| 29 | |
| 30 | flag.Usage = func() { |
| 31 | fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0]) |
| 32 | flag.PrintDefaults() |
| 33 | fmt.Fprintf(flag.CommandLine.Output(), "\ne.g., on mac, to run all of the std go files except cmd which is large and slow:\npi -r -ex cmd /usr/local/Cellar/go/1.11.3/libexec/src\n\n") |
| 34 | } |
| 35 | |
| 36 | // process command args |
| 37 | flag.StringVar(&path, "path", "", "path to open; can be to a directory or a filename within the directory; or just last arg without a flag") |
| 38 | flag.BoolVar(&recurse, "r", false, "recursive; apply to subdirectories") |
| 39 | flag.StringVar(&excl, "ex", "", "comma-separated list of directory names to exclude, for recursive case") |
| 40 | flag.Parse() |
| 41 | if path == "" { |
| 42 | if flag.NArg() > 0 { |
| 43 | path = flag.Arg(0) |
| 44 | } else { |
| 45 | path = "." |
| 46 | } |
| 47 | } |
| 48 | Excludes = strings.Split(excl, ",") |
| 49 | |
| 50 | // todo: assuming go for now |
| 51 | if recurse { |
| 52 | DoGoRecursive(path) |
| 53 | } else { |
| 54 | DoGoPath(path) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func DoGoPath(path string) { |
| 59 | fmt.Printf("Processing path: %v\n", path) |
nothing calls this directly
no test coverage detected