summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go83
1 files changed, 49 insertions, 34 deletions
diff --git a/main.go b/main.go
index 1d462e2..e7a97f8 100644
--- a/main.go
+++ b/main.go
@@ -1,51 +1,66 @@
package main
import (
- "os"
- "path/filepath"
-
+ "go.wit.com/dev/alexflint/arg"
+ "go.wit.com/gui"
+ "go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
-// This is the beginning of the binary tree of GUI widgets
-// var myGui *gui.Node
+var VERSION string
-// this is a basic window. the user can open and close it
-// var basicWindow *gadgets.BasicWindow
+var rv *repolist.RepoList
func main() {
- if args.Repo == "" {
- log.Info("You need to tell me what repo you want to work on")
- log.Info("")
- log.Info("go-clone --repo go.wit.com/apps/helloworld")
- os.Exit(0)
+
+ var myargs args
+ // tmp := arg.MustParse(&myargs)
+ arg.MustParse(&myargs)
+
+ if myargs.Work {
+ shell.Mkdir("work")
+ } else {
+ // filepath := filepath.Join("/home/jcarr/go/src")
+ // os.Chdir(filepath)
}
- /*
- if args.Gui == "" {
- myGui = gui.New()
- myGui.Default()
- }
- */
+ // if myargs.Repo == "" {
+ // // tmp.WriteHelp(os.Stdout)
+ // // fmt.Println("hello world")
+ // tmp := myargs.Description()
+ // fmt.Println(tmp)
+ // os.Exit(0)
+ // }
- filepath := filepath.Join("/home/jcarr/go/src", args.Repo)
- os.Chdir(filepath)
+ b := gui.RawBox()
+ rv = repolist.AutotypistView(b)
- shell.TestTerminalColor()
+ // shell.TestTerminalColor()
readControlFile()
- os.Exit(0)
- /*
- // run the debugger if triggered from the commandline
- if debugger.ArgDebug() {
- go func() {
- log.Sleep(2)
- debugger.DebugWindow()
- }()
- }
+ clone(myargs.Repo)
+ rv.NewRepo(myargs.Repo)
+
+ rv.NewRepo("go.wit.com/apps/helloworld")
+
+ for _, repo := range rv.AllRepos() {
+ log.Info("found repo", repo.GoPath(), repo.Status.Path())
+ }
- // go will sit here until the window exits
- gui.Watchdog()
- os.Exit(0)
- */
+ rv.Watchdog(func() {
+ log.Info("watchdog")
+ })
}
+
+func clone(path string) {
+ shell.RunPath([]string{"git", "clone", path})
+}
+
+func findWorkDir() {
+ if myargs.Work {
+ shell.Mkdir("work")
+ shell.Mkdir("work")
+ }
+ // filepath := filepath.Join("/home/jcarr/go/src")
+ // os.Chdir(filepath)
+