From 57c61847c02e9b2f3c2e36f9c77c9dcb8da01b8c Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 7 Mar 2024 16:45:49 -0600 Subject: make a .git repo --- main.go | 87 ++++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 51 insertions(+), 36 deletions(-) (limited to 'main.go') 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() - }() - } - - // go will sit here until the window exits - gui.Watchdog() - os.Exit(0) - */ + + 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()) + } + + 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) + -- cgit v1.2.3