diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | argv.go | 8 | ||||
| -rwxr-xr-x | build | 2 | ||||
| -rw-r--r-- | control | 10 | ||||
| -rw-r--r-- | doGit.go | 27 | ||||
| -rw-r--r-- | main.go | 15 |
6 files changed, 57 insertions, 7 deletions
@@ -1,5 +1,7 @@ *.swp go.mod go.sum +wit wit-test /files/* +*.deb @@ -20,6 +20,7 @@ import ( var argv args type args struct { + Git *GitCmd `arg:"subcommand:git" help:"git stuff"` TestBuild *DefaultCmd `arg:"subcommand:build" help:"try appropriate 'go build'"` DebBuild *DebianCmd `arg:"subcommand:debian" help:"build missing .deb packages"` MacBuild *EmptyCmd `arg:"subcommand:macos" help:"build macos packages"` @@ -50,6 +51,11 @@ type DefaultCmd struct { Force bool `arg:"--force" help:"rebuild everything"` } +type GitCmd struct { + Log *EmptyCmd `arg:"subcommand:log" help:"go-clone from a gowebd repomap"` + Who *EmptyCmd `arg:"subcommand:who" help:"go-clone from a gowebd repomap"` +} + type EmptyCmd struct { } @@ -90,7 +96,7 @@ func (args) Appname() string { func (a args) DoAutoComplete(pb *prep.Auto) { if pb.Cmd == "" { - pb.Autocomplete3([]string{"--bash", "build", "debian", "install", "upgrade", "macos", "--witcom --version"}) + pb.Autocomplete3([]string{"push", "build", "debian", "install", "upgrade", "macos", "git", "--witcom --version"}) } else { pb.SubCommand(pb.Argv...) } @@ -1,4 +1,4 @@ #!/bin/bash -x mkdir -p files/usr/share/bash-completion/completions/ -wit-test --bash > files/usr/share/bash-completion/completions/wit-test +wit --bash > files/usr/share/bash-completion/completions/wit @@ -0,0 +1,10 @@ +Source: wit-tools +Build-Depends: golang +Package: wit-tools +Conflicts: wit +Maintainer: Jeff Carr <[email protected]> +Architecture: amd64 +Depends: +URL: https://go.wit.com/apps/apps/utils/wit +Description: used on wit cloud machines + customized for WIT private clouds diff --git a/doGit.go b/doGit.go new file mode 100644 index 0000000..3b77830 --- /dev/null +++ b/doGit.go @@ -0,0 +1,27 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +import ( + "go.wit.com/lib/gui/shell" + "go.wit.com/log" +) + +func doGit() error { + log.DaemonMode(true) + defer log.DaemonMode(false) + + if argv.Git.Log != nil { + fstr := "--format=\"%h %>(24)%ar %>(20)%an %s" + cmd := []string{"git", "log", fstr} + shell.RunVerbose(cmd) + } + + if argv.Git.Who != nil { + cmd := []string{"git", "who"} + shell.RunVerbose(cmd) + } + + return nil +} @@ -22,7 +22,7 @@ var VERSION string var BUILDTIME string // used for shell auto completion -var ARGNAME string = "wit-test" // todo: get this from $0 ? +var ARGNAME string = "wit" // todo: get this from $0 ? var failed map[*gitpb.Repo]string var state map[*gitpb.Repo]string @@ -34,16 +34,21 @@ func main() { dumpDebug() - failed = make(map[*gitpb.Repo]string) - state = make(map[*gitpb.Repo]string) - debnames = make(map[*gitpb.Repo]string) - if argv.Upgrade != nil { me.machine, _ = zoopb.InitMachine() doAptUpgrade() okExit("") } + if argv.Git != nil { + doGit() + okExit("") + } + + failed = make(map[*gitpb.Repo]string) + state = make(map[*gitpb.Repo]string) + debnames = make(map[*gitpb.Repo]string) + me.forge = forgepb.Init() me.forge.Config.DumpENV() |
