fix something
This commit is contained in:
parent
18422baceb
commit
8edefa6dad
6
Makefile
6
Makefile
|
@ -4,9 +4,9 @@ VERSION = $(shell git describe --tags)
|
||||||
DATE = $(shell date +%Y.%m.%d)
|
DATE = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
run: clean goimports vet install
|
run: clean goimports vet install
|
||||||
go-deb --release --no-gui --auto --forge go.wit.com/apps/autogenpb --dir /tmp/
|
go-deb --release --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 --release --auto --forge go.wit.com/apps/go-mod-clean --dir /tmp/
|
||||||
@#go-deb --forge go.wit.com/apps/autotypist --no-gui --auto
|
@#go-deb --forge go.wit.com/apps/autotypist --auto
|
||||||
ls -lth /tmp/*deb
|
ls -lth /tmp/*deb
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
|
|
10
argv.go
10
argv.go
|
@ -12,7 +12,9 @@ import (
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type args struct {
|
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"`
|
Auto bool `arg:"--auto" help:"automatically attempt to make the .deb"`
|
||||||
Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"`
|
Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"`
|
||||||
Forge string `arg:"--forge" help:"use a git repo from forge"`
|
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/"`
|
KeepFiles bool `arg:"--keep-files" help:"keep the build files/"`
|
||||||
Force bool `arg:"--force" default:"false" help:"force overwrite an existing .deb file"`
|
Force bool `arg:"--force" default:"false" help:"force overwrite an existing .deb file"`
|
||||||
Verbose bool `arg:"--verbose" help:"show more things"`
|
Verbose bool `arg:"--verbose" help:"show more things"`
|
||||||
Bash bool `arg:"--bash" help:"generate bash completion"`
|
Bash bool `arg:"--bash" help:"generate bash completion"`
|
||||||
BashAuto []string `arg:"--auto-complete" help:"todo: move this to go-arg"`
|
BashAuto []string `arg:"--auto-complete" help:"todo: move this to go-arg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (args) Version() string {
|
func (args) Version() string {
|
||||||
|
@ -54,7 +56,7 @@ func (a args) DoAutoComplete(argv []string) {
|
||||||
default:
|
default:
|
||||||
if argv[0] == ARGNAME {
|
if argv[0] == ARGNAME {
|
||||||
// list the subcommands here
|
// list the subcommands here
|
||||||
fmt.Println("arch build")
|
fmt.Println("arch build gui show")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|
31
main.go
31
main.go
|
@ -4,8 +4,9 @@ import (
|
||||||
"embed"
|
"embed"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
"go.wit.com/lib/fhelp"
|
"go.wit.com/lib/fhelp"
|
||||||
"go.wit.com/lib/gui/prep"
|
"go.wit.com/lib/gui/prep"
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
|
@ -25,6 +26,9 @@ var argv args
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
me = new(mainType)
|
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 {
|
if err := fhelp.ConfigureENV(); err != nil {
|
||||||
badExit(err)
|
badExit(err)
|
||||||
|
@ -53,8 +57,11 @@ func main() {
|
||||||
log.Info("found repo", me.repo.GetGoPath())
|
log.Info("found repo", me.repo.GetGoPath())
|
||||||
}
|
}
|
||||||
// build()
|
// 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()
|
me.basicWindow = makebasicWindow()
|
||||||
|
|
||||||
// figure out where we are working from
|
// figure out where we are working from
|
||||||
|
@ -94,10 +101,20 @@ func main() {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// only load teh toolkit if you get this far
|
if argv.Gui != nil {
|
||||||
me.myGui.Start() // loads the GUI toolkit
|
// only load teh toolkit if you get this far
|
||||||
me.basicWindow.Show()
|
me.myGui.Start() // loads the GUI toolkit
|
||||||
// go will sit here until the window exits
|
me.basicWindow.Show()
|
||||||
gui.Watchdog()
|
debug()
|
||||||
|
}
|
||||||
|
log.Info("go-deb: nothing to do in argv")
|
||||||
os.Exit(0)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue