more argv cleanups
This commit is contained in:
parent
778de10e87
commit
3505a66d84
2
Makefile
2
Makefile
|
@ -74,7 +74,7 @@ patches-list: install
|
||||||
forge --list-patches --url "http://localhost:2233/"
|
forge --list-patches --url "http://localhost:2233/"
|
||||||
|
|
||||||
dirty: install
|
dirty: install
|
||||||
forge --dirty
|
forge do --dirty
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
reset
|
reset
|
||||||
|
|
4
argv.go
4
argv.go
|
@ -20,6 +20,7 @@ type DoCmd struct {
|
||||||
GitReset bool `arg:"--git-reset" help:"run 'git reset --hard'"`
|
GitReset bool `arg:"--git-reset" help:"run 'git reset --hard'"`
|
||||||
Scan bool `arg:"--scan" help:"reload protobuf from .git/"`
|
Scan bool `arg:"--scan" help:"reload protobuf from .git/"`
|
||||||
Force bool `arg:"--force" help:"force redo things"`
|
Force bool `arg:"--force" help:"force redo things"`
|
||||||
|
Dirty bool `arg:"--dirty" help:"update git CheckDirty()"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
|
@ -31,7 +32,6 @@ type args struct {
|
||||||
DryRun bool `arg:"--dry-run" help:"show what would be run"`
|
DryRun bool `arg:"--dry-run" help:"show what would be run"`
|
||||||
Fix bool `arg:"--fix" help:"fix config, save config & exit"`
|
Fix bool `arg:"--fix" help:"fix config, save config & exit"`
|
||||||
Delete string `arg:"--delete" help:"delete this repo"`
|
Delete string `arg:"--delete" help:"delete this repo"`
|
||||||
Dirty bool `arg:"--dirty" help:"git CheckDirty() on every repo"`
|
|
||||||
User bool `arg:"--user" help:"git checkout user"`
|
User bool `arg:"--user" help:"git checkout user"`
|
||||||
Devel bool `arg:"--devel" help:"git checkout devel"`
|
Devel bool `arg:"--devel" help:"git checkout devel"`
|
||||||
Master bool `arg:"--master" help:"git checkout master"`
|
Master bool `arg:"--master" help:"git checkout master"`
|
||||||
|
@ -59,5 +59,3 @@ Examples:
|
||||||
# these options are intended for automation. You probably just want to use the GUI.
|
# these options are intended for automation. You probably just want to use the GUI.
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
// forge --map lib/foo https://github.com/me/myfoo # map go.wit.com/lib/foo -> github.com/me/myfoo
|
|
||||||
|
|
26
doCommon.go
26
doCommon.go
|
@ -1,6 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -33,6 +36,29 @@ func doGitPull() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func doCheckDirty() {
|
||||||
|
now := time.Now()
|
||||||
|
all := me.forge.Repos.SortByFullPath()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
dirty := repo.IsDirty()
|
||||||
|
if repo.CheckDirty() {
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
if !dirty {
|
||||||
|
configSave = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if dirty {
|
||||||
|
configSave = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
doCobol()
|
||||||
|
log.Info("dirty check took:", shell.FormatDuration(time.Since(now)))
|
||||||
|
me.forge.SetConfigSave(configSave)
|
||||||
|
}
|
||||||
|
|
||||||
func doGitReset() {
|
func doGitReset() {
|
||||||
all := me.found.SortByFullPath()
|
all := me.found.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
|
|
50
main.go
50
main.go
|
@ -4,11 +4,9 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/gui/shell"
|
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -40,11 +38,6 @@ func main() {
|
||||||
me.forge = forgepb.Init()
|
me.forge = forgepb.Init()
|
||||||
me.found = new(gitpb.Repos)
|
me.found = new(gitpb.Repos)
|
||||||
|
|
||||||
if configSave {
|
|
||||||
me.forge.ConfigSave()
|
|
||||||
configSave = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if argv.User {
|
if argv.User {
|
||||||
me.forge.CheckoutUser()
|
me.forge.CheckoutUser()
|
||||||
okExit("")
|
okExit("")
|
||||||
|
@ -69,38 +62,6 @@ func main() {
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.Dirty {
|
|
||||||
now := time.Now()
|
|
||||||
all := me.forge.Repos.SortByFullPath()
|
|
||||||
for all.Scan() {
|
|
||||||
repo := all.Next()
|
|
||||||
dirty := repo.IsDirty()
|
|
||||||
if repo.CheckDirty() {
|
|
||||||
me.found.AppendUniqueGoPath(repo)
|
|
||||||
if !dirty {
|
|
||||||
configSave = true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if dirty {
|
|
||||||
configSave = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
doCobol()
|
|
||||||
log.Info("dirty check took:", shell.FormatDuration(time.Since(now)))
|
|
||||||
me.forge.SetConfigSave(configSave)
|
|
||||||
okExit("")
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
// var count int
|
|
||||||
all := me.forge.Repos.SortByFullPath()
|
|
||||||
for all.Scan() {
|
|
||||||
repo := all.Next()
|
|
||||||
verifyPrint(repo)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if argv.Fix {
|
if argv.Fix {
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
@ -121,6 +82,12 @@ func main() {
|
||||||
// now, do something to all of them (or just print out a table of them)
|
// now, do something to all of them (or just print out a table of them)
|
||||||
var done bool = false
|
var done bool = false
|
||||||
if argv.Do != nil {
|
if argv.Do != nil {
|
||||||
|
if argv.Do.Dirty {
|
||||||
|
doCheckDirty()
|
||||||
|
okExit("")
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
|
||||||
if argv.Do.Scan {
|
if argv.Do.Scan {
|
||||||
doScan()
|
doScan()
|
||||||
done = true
|
done = true
|
||||||
|
@ -154,6 +121,11 @@ func main() {
|
||||||
okExit("patches")
|
okExit("patches")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if configSave {
|
||||||
|
me.forge.ConfigSave()
|
||||||
|
configSave = false
|
||||||
|
}
|
||||||
|
|
||||||
// if the user doesn't want to open the GUI and
|
// if the user doesn't want to open the GUI and
|
||||||
// nothing else was specified to be done,
|
// nothing else was specified to be done,
|
||||||
// then just list the table to stdout
|
// then just list the table to stdout
|
||||||
|
|
Loading…
Reference in New Issue