cli user interface
This commit is contained in:
parent
f6a79c3be8
commit
5c6bbcdbb2
7
argv.go
7
argv.go
|
@ -25,7 +25,7 @@ type args struct {
|
||||||
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
|
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
|
||||||
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 *EmptyCmd `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"`
|
||||||
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
|
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
|
||||||
Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
|
Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
|
||||||
URL string `arg:"--connect" help:"forge url"`
|
URL string `arg:"--connect" help:"forge url"`
|
||||||
|
@ -42,6 +42,11 @@ type args struct {
|
||||||
type EmptyCmd struct {
|
type EmptyCmd struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NormalCmd struct {
|
||||||
|
On *EmptyCmd `arg:"subcommand:on" help:"turn normal mode on"`
|
||||||
|
Off *EmptyCmd `arg:"subcommand:off" help:"turn normal mode off"`
|
||||||
|
}
|
||||||
|
|
||||||
type CommitCmd struct {
|
type CommitCmd struct {
|
||||||
Submit bool `arg:"--submit" default:"true" help:"submit the patches to forge"`
|
Submit bool `arg:"--submit" default:"true" help:"submit the patches to forge"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,8 @@ func (args) doBashAuto() {
|
||||||
fmt.Println("--full")
|
fmt.Println("--full")
|
||||||
case "merge":
|
case "merge":
|
||||||
fmt.Println("devel master")
|
fmt.Println("devel master")
|
||||||
|
case "normal":
|
||||||
|
fmt.Println("on off")
|
||||||
case "pull":
|
case "pull":
|
||||||
fmt.Println("dirty clean list patches --force")
|
fmt.Println("dirty clean list patches --force")
|
||||||
case "patch":
|
case "patch":
|
||||||
|
|
|
@ -170,6 +170,14 @@ func findReposWithPatches() *gitpb.Repos {
|
||||||
|
|
||||||
// show anything that differs between 'devel' & 'master' branches
|
// show anything that differs between 'devel' & 'master' branches
|
||||||
if repo.GetDevelVersion() != repo.GetMasterVersion() {
|
if repo.GetDevelVersion() != repo.GetMasterVersion() {
|
||||||
|
// this repo.State code isn't great, but it got me here quickly
|
||||||
|
// I'll defend my code by saying it's faster for me if I do dumb things
|
||||||
|
// sometimes and fix them later. Probably some employee will have to
|
||||||
|
// fix this. if that is the case I owe you lunch. or stock options
|
||||||
|
if repo.State == "DEVEL behind MASTER" {
|
||||||
|
// log.Info("repo state", repo.FullPath, repo.State)
|
||||||
|
continue
|
||||||
|
}
|
||||||
found.AppendByFullPath(repo)
|
found.AppendByFullPath(repo)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
21
main.go
21
main.go
|
@ -140,6 +140,27 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.Normal != nil {
|
if argv.Normal != nil {
|
||||||
|
if argv.Normal.On != nil {
|
||||||
|
if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL {
|
||||||
|
log.Info("you are already in the normal state")
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
me.forge.Config.Mode = forgepb.ForgeMode_NORMAL
|
||||||
|
me.forge.Config.ConfigSave()
|
||||||
|
log.Info("normal mode on")
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
if argv.Normal.Off != nil {
|
||||||
|
if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {
|
||||||
|
log.Info("you were aleady not in the normal state")
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
me.forge.Config.Mode = forgepb.ForgeMode_MASTER
|
||||||
|
me.forge.Config.ConfigSave()
|
||||||
|
log.Info("normal mode off")
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
|
||||||
if doNormal() {
|
if doNormal() {
|
||||||
log.Infof("all %d repos are on your user branch. It is safe to write code now.\n", me.forge.Repos.Len())
|
log.Infof("all %d repos are on your user branch. It is safe to write code now.\n", me.forge.Repos.Len())
|
||||||
if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {
|
if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {
|
||||||
|
|
Loading…
Reference in New Issue