summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go2
-rw-r--r--argvAutoshell.go4
-rw-r--r--main.go21
3 files changed, 26 insertions, 1 deletions
diff --git a/argv.go b/argv.go
index 110de23..96c0f1d 100644
--- a/argv.go
+++ b/argv.go
@@ -21,7 +21,9 @@ type args struct {
GitPull *FindCmd `arg:"subcommand:pull" help:"run 'git pull'"`
Rescan *EmptyCmd `arg:"subcommand:rescan" help:"recreate the git protobuf repos.pb file"`
Delete *EmptyCmd `arg:"subcommand:delete" help:"untrack a repo"`
+ Commit *EmptyCmd `arg:"subcommand:commit" help:"smart 'git commit'"`
URL string `arg:"--connect" help:"gowebd url"`
+ All bool `arg:"--all" help:"git commit --all"`
Show string `arg:"--show" help:"show a repo"`
Bash bool `arg:"--bash" help:"generate bash completion"`
BashAuto []string `arg:"--auto-complete" help:"does the actual autocompletion"`
diff --git a/argvAutoshell.go b/argvAutoshell.go
index 1d4b8cf..4f8de85 100644
--- a/argvAutoshell.go
+++ b/argvAutoshell.go
@@ -21,6 +21,8 @@ func (args) doBashAuto() {
switch argv.BashAuto[0] {
case "checkout":
fmt.Println("user devel master")
+ case "commit":
+ fmt.Println("--all")
case "config":
fmt.Println("add fix list delete")
case "list":
@@ -41,7 +43,7 @@ func (args) doBashAuto() {
default:
if argv.BashAuto[0] == ARGNAME {
// list the subcommands here
- fmt.Println("--bash --show checkout config dirty delete hard-reset list patch pull rescan")
+ fmt.Println("--bash --show checkout commit config dirty delete hard-reset list patch pull rescan")
}
}
os.Exit(0)
diff --git a/main.go b/main.go
index 76e4a0a..bd3d743 100644
--- a/main.go
+++ b/main.go
@@ -8,6 +8,7 @@ import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
+ "go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
@@ -60,6 +61,26 @@ func main() {
okExit("")
}
+ if argv.Commit != nil {
+ pwd, _ := os.Getwd()
+ repo := me.forge.Repos.FindByFullPath(pwd)
+ if repo == nil {
+ log.Info("what branch are you on?: todo: examine this")
+ okExit("")
+ }
+ if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
+ me.found.Append(repo)
+ me.forge.PrintHumanTable(me.found)
+ log.Info("")
+ log.Info("wrong branch. Can not commit on", repo.GetCurrentBranchName())
+ log.Info("")
+ okExit("")
+ }
+ shell.Exec([]string{"git", "diff"})
+ shell.Exec([]string{"git", "commit", "--all"})
+ okExit("forge done")
+ }
+
if argv.Checkout != nil {
if argv.Checkout.User != nil {
if argv.Force {