common code. add "gui" to open the gui
This commit is contained in:
parent
11bf5481c7
commit
ce813a3450
1
argv.go
1
argv.go
|
@ -23,6 +23,7 @@ type args struct {
|
||||||
Debug *EmptyCmd `arg:"subcommand:debug" help:"debug forge"`
|
Debug *EmptyCmd `arg:"subcommand:debug" help:"debug forge"`
|
||||||
Dirty *DirtyCmd `arg:"subcommand:dirty" help:"show dirty git repos"`
|
Dirty *DirtyCmd `arg:"subcommand:dirty" help:"show dirty git repos"`
|
||||||
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
|
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
|
||||||
|
Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"`
|
||||||
List *FindCmd `arg:"subcommand:list" help:"print a table of the current repos"`
|
List *FindCmd `arg:"subcommand:list" help:"print a table of the current repos"`
|
||||||
Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"`
|
Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"`
|
||||||
Normal *NormalCmd `arg:"subcommand:normal" help:"set every repo to the default state for software development"`
|
Normal *NormalCmd `arg:"subcommand:normal" help:"set every repo to the default state for software development"`
|
||||||
|
|
|
@ -34,7 +34,7 @@ func doNormal() bool {
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
log.Info("Some repos are not in a 'normal' state. error count =", count)
|
log.Info("Some repos are not in a 'normal' state. error count =", count)
|
||||||
log.Info("TODO: list the repos here. forge patch repos?")
|
log.Info("TODO: list the repos here. forge patch repos?")
|
||||||
dumpDirtyRepos()
|
dumpWorkRepos()
|
||||||
configSave = true
|
configSave = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
14
doPatch.go
14
doPatch.go
|
@ -51,7 +51,7 @@ func doPatchSubmit() error {
|
||||||
|
|
||||||
func doPatch() error {
|
func doPatch() error {
|
||||||
if argv.Patch.Repos != nil {
|
if argv.Patch.Repos != nil {
|
||||||
dumpDirtyRepos()
|
dumpWorkRepos()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,11 +156,17 @@ func doPatch() error {
|
||||||
|
|
||||||
// if nothing, show patches & dirty repos
|
// if nothing, show patches & dirty repos
|
||||||
me.forge.Patchsets.PrintTable()
|
me.forge.Patchsets.PrintTable()
|
||||||
dumpDirtyRepos()
|
dumpWorkRepos()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpDirtyRepos() {
|
// Shows repos that are:
|
||||||
|
// - git dirty repos
|
||||||
|
// - repos with 'user' branch patches not in 'devel' branch
|
||||||
|
// - repos with awaiting master branch verions
|
||||||
|
//
|
||||||
|
// return true if any are found
|
||||||
|
func dumpWorkRepos() bool {
|
||||||
// always run dirty first
|
// always run dirty first
|
||||||
me.forge.CheckDirtyQuiet()
|
me.forge.CheckDirtyQuiet()
|
||||||
|
|
||||||
|
@ -169,9 +175,11 @@ func dumpDirtyRepos() {
|
||||||
found := findReposWithPatches()
|
found := findReposWithPatches()
|
||||||
if found.Len() == 0 {
|
if found.Len() == 0 {
|
||||||
log.Info("you currently have no repos with patches")
|
log.Info("you currently have no repos with patches")
|
||||||
|
return false
|
||||||
} else {
|
} else {
|
||||||
me.forge.PrintHumanTable(found)
|
me.forge.PrintHumanTable(found)
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns bad if patches can not be applied
|
// returns bad if patches can not be applied
|
||||||
|
|
17
main.go
17
main.go
|
@ -257,9 +257,20 @@ func main() {
|
||||||
// open the gui unless the user performed some other
|
// open the gui unless the user performed some other
|
||||||
// basically, if you run just 'forge' it should open the GUI
|
// basically, if you run just 'forge' it should open the GUI
|
||||||
|
|
||||||
// if opening the GUI, always check git for dirty repos
|
if argv.Gui != nil {
|
||||||
me.forge.CheckDirty()
|
// if opening the GUI, always check git for dirty repos
|
||||||
doGui()
|
me.forge.CheckDirty()
|
||||||
|
doGui()
|
||||||
|
}
|
||||||
|
// got to the end with nothing to do (?)
|
||||||
|
if dumpWorkRepos() {
|
||||||
|
// found some repos at least
|
||||||
|
} else {
|
||||||
|
// every repo is in a really clean state. no extra files anywhere
|
||||||
|
// no dirty repos, no repos that need to be published
|
||||||
|
// nothing different between user and master branch version. not common
|
||||||
|
log.Info("All of your git repositories appear to be in perfect shape")
|
||||||
|
}
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue