cli user interface

This commit is contained in:
Jeff Carr 2025-09-06 21:50:43 -05:00
parent f6a79c3be8
commit 5c6bbcdbb2
4 changed files with 37 additions and 1 deletions

View File

@ -25,7 +25,7 @@ type args struct {
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
List *FindCmd `arg:"subcommand:list" help:"print a table of the current repos"`
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"`
Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
URL string `arg:"--connect" help:"forge url"`
@ -42,6 +42,11 @@ type args 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 {
Submit bool `arg:"--submit" default:"true" help:"submit the patches to forge"`
}

View File

@ -43,6 +43,8 @@ func (args) doBashAuto() {
fmt.Println("--full")
case "merge":
fmt.Println("devel master")
case "normal":
fmt.Println("on off")
case "pull":
fmt.Println("dirty clean list patches --force")
case "patch":

View File

@ -170,6 +170,14 @@ func findReposWithPatches() *gitpb.Repos {
// show anything that differs between 'devel' & 'master' branches
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)
continue
}

21
main.go
View File

@ -140,6 +140,27 @@ func main() {
}
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() {
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 {