main.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package main
  2. import (
  3. "log"
  4. "os"
  5. "regexp"
  6. )
  7. var (
  8. appRoot string
  9. regexes map[string]*regexp.Regexp
  10. assignRegex *regexp.Regexp
  11. )
  12. func init() {
  13. var err error
  14. appRoot, err = os.Getwd()
  15. if err != nil {
  16. log.Fatalf("Can't get working dir: %s", err)
  17. }
  18. // TODO update regex to look for things like:
  19. // TODO ability to add/filter regex
  20. // client("AKAI32fJ334...",
  21. regexes = map[string]*regexp.Regexp{
  22. "github": regexp.MustCompile(`[g|G][i|I][t|T][h|H][u|U][b|B].*(=|:|:=|<-).*\w+.*`),
  23. "aws": regexp.MustCompile(`[a|A][w|W][s|S].*(=|:=|:|<-).*\w+.*`),
  24. "heroku": regexp.MustCompile(`[h|H][e|E][r|R][o|O][k|K][u|U].*(=|:=|:|<-).*\w+.*`),
  25. "facebook": regexp.MustCompile(`[f|F][a|A][c|C][e|E][b|B][o|O][o|O][k|K].*(=|:=|:|<-).*\w+.*`),
  26. "twitter": regexp.MustCompile(`[t|T][w|W][i|I][t|T][t|T][e|E][r|R].*(=|:=|:|<-).*\w+.*`),
  27. "reddit": regexp.MustCompile(`[r|R][e|E][d|D][d|D][i|I][t|T].*(=|:=|:|<-).*\w+.*`),
  28. "twilio": regexp.MustCompile(`[t|T][w|W][i|I][l|L][i|I][o|O].*(=|:=|:|<-).*\w+.*`),
  29. }
  30. assignRegex = regexp.MustCompile(`(=|:|:=|<-)`)
  31. }
  32. func main() {
  33. args := os.Args[2:]
  34. repoURL := os.Args[1]
  35. opts := parseOptions(args)
  36. start(opts, repoURL)
  37. }