diff --git a/Makefile b/Makefile index b8d7d32..33ab2cd 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ VERSION = $(shell git describe --tags) DATE = $(shell date +%Y.%m.%d) run: clean goimports vet install - go-deb --release --no-gui --auto --forge go.wit.com/apps/autogenpb --dir /tmp/ - go-deb --release --no-gui --auto --forge go.wit.com/apps/go-mod-clean --dir /tmp/ - @#go-deb --forge go.wit.com/apps/autotypist --no-gui --auto + go-deb --release --auto --forge go.wit.com/apps/autogenpb --dir /tmp/ + go-deb --release --auto --forge go.wit.com/apps/go-mod-clean --dir /tmp/ + @#go-deb --forge go.wit.com/apps/autotypist --auto ls -lth /tmp/*deb vet: diff --git a/argv.go b/argv.go index ca88012..da2e4ba 100644 --- a/argv.go +++ b/argv.go @@ -12,7 +12,9 @@ import ( */ type args struct { - Commit *EmptyCmd `arg:"subcommand:commit" help:"'git commit' but errors out if on wrong branch"` + Commit *EmptyCmd `arg:"subcommand:commit" help:"'git commit' but errors out if on wrong branch"` + Show *EmptyCmd `arg:"subcommand:show" help:"show what would be done"` + Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"` Auto bool `arg:"--auto" help:"automatically attempt to make the .deb"` Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"` Forge string `arg:"--forge" help:"use a git repo from forge"` @@ -21,8 +23,8 @@ type args struct { KeepFiles bool `arg:"--keep-files" help:"keep the build files/"` Force bool `arg:"--force" default:"false" help:"force overwrite an existing .deb file"` Verbose bool `arg:"--verbose" help:"show more things"` - Bash bool `arg:"--bash" help:"generate bash completion"` - BashAuto []string `arg:"--auto-complete" help:"todo: move this to go-arg"` + Bash bool `arg:"--bash" help:"generate bash completion"` + BashAuto []string `arg:"--auto-complete" help:"todo: move this to go-arg"` } func (args) Version() string { @@ -54,7 +56,7 @@ func (a args) DoAutoComplete(argv []string) { default: if argv[0] == ARGNAME { // list the subcommands here - fmt.Println("arch build") + fmt.Println("arch build gui show") } } os.Exit(0) diff --git a/main.go b/main.go index 9d9c016..205e90f 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,9 @@ import ( "embed" "os" "path/filepath" + "time" - "go.wit.com/gui" + "go.wit.com/dev/alexflint/arg" "go.wit.com/lib/fhelp" "go.wit.com/lib/gui/prep" "go.wit.com/lib/gui/shell" @@ -25,6 +26,9 @@ var argv args func main() { me = new(mainType) + prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv) + me.myGui = prep.Gui() // prepares the GUI package for go-args + me.pp = arg.MustParse(&argv) if err := fhelp.ConfigureENV(); err != nil { badExit(err) @@ -53,8 +57,11 @@ func main() { log.Info("found repo", me.repo.GetGoPath()) } // build() + if argv.Show != nil { + log.Info("todo: show", me.repo.GetGoPath()) + okExit("") + } - me.myGui = prep.Gui() // prepares the GUI package for go-args me.basicWindow = makebasicWindow() // figure out where we are working from @@ -94,10 +101,20 @@ func main() { os.Exit(0) } - // only load teh toolkit if you get this far - me.myGui.Start() // loads the GUI toolkit - me.basicWindow.Show() - // go will sit here until the window exits - gui.Watchdog() + if argv.Gui != nil { + // only load teh toolkit if you get this far + me.myGui.Start() // loads the GUI toolkit + me.basicWindow.Show() + debug() + } + log.Info("go-deb: nothing to do in argv") os.Exit(0) } + +func debug() { + time.Sleep(2 * time.Second) + for { + log.Info("idle loop() todo: could check for things here") + time.Sleep(90 * time.Second) + } +}