summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2018-11-16 00:40:34 +0300
committerIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2018-11-16 00:40:34 +0300
commit50c9f38b1bbf58b8b463142e1dbeb99f19e4ed29 (patch)
treefd8dc94ed11d6e9d3250d2c92065914006ba7cec /main.go
parentiterating (diff)
downloadgitbatch-50c9f38b1bbf58b8b463142e1dbeb99f19e4ed29.tar.gz
pass directory as input arg.
Diffstat (limited to 'main.go')
-rw-r--r--main.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/main.go b/main.go
index 99dd21d..34b6d35 100644
--- a/main.go
+++ b/main.go
@@ -3,13 +3,30 @@ package main
import (
"io/ioutil"
"log"
+ "os"
"os/exec"
"syscall"
+// "gopkg.in/alecthomas/kingpin.v2"
)
+//var (
+// currentDirectory, err = os.Getwd()
+// directory = kingpin.Flag("directory", "Directory to roam for git repositories.").Default(currentDirectory).Short('d').String()
+//)
+
func main() {
- repo := "/Users/ibrahim/git"
- FindRepos(repo)
+
+ args := os.Args[1:]
+ if len(args) > 0 {
+ repo := args[0]
+ FindRepos(repo)
+ } else {
+ repo, err := os.Getwd()
+ if err != nil {
+ log.Fatal(err)
+ }
+ FindRepos(repo)
+ }
}
func FindRepos(directory string) []string {