mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: change root command to include commit wrapper options
This commit is contained in:
@@ -2,18 +2,38 @@ module main
|
|||||||
|
|
||||||
go 1.21.0
|
go 1.21.0
|
||||||
|
|
||||||
require dagger.io/dagger v0.10.0
|
require (
|
||||||
|
dagger.io/dagger v0.10.0
|
||||||
|
github.com/charmbracelet/bubbles v0.20.0
|
||||||
|
github.com/charmbracelet/bubbletea v1.1.1
|
||||||
|
github.com/charmbracelet/lipgloss v0.13.0
|
||||||
|
github.com/spf13/cobra v1.8.1
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/99designs/gqlgen v0.17.31 // indirect
|
github.com/99designs/gqlgen v0.17.31 // indirect
|
||||||
github.com/Khan/genqlient v0.6.0 // indirect
|
github.com/Khan/genqlient v0.6.0 // indirect
|
||||||
github.com/adrg/xdg v0.4.0 // indirect
|
github.com/adrg/xdg v0.4.0 // indirect
|
||||||
|
github.com/atotto/clipboard v0.1.4 // indirect
|
||||||
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||||
|
github.com/charmbracelet/x/ansi v0.2.3 // indirect
|
||||||
|
github.com/charmbracelet/x/term v0.2.0 // indirect
|
||||||
|
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
|
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||||
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||||
github.com/spf13/cobra v1.8.1 // indirect
|
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
||||||
|
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||||
|
github.com/muesli/termenv v0.15.2 // indirect
|
||||||
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
|
github.com/sahilm/fuzzy v0.1.1 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
github.com/vektah/gqlparser/v2 v2.5.6 // indirect
|
github.com/vektah/gqlparser/v2 v2.5.6 // indirect
|
||||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
|
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
|
||||||
golang.org/x/sync v0.6.0 // indirect
|
golang.org/x/sync v0.8.0 // indirect
|
||||||
golang.org/x/sys v0.14.0 // indirect
|
golang.org/x/sys v0.26.0 // indirect
|
||||||
|
golang.org/x/text v0.19.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"main/src_code/go_src/cmd/tui"
|
||||||
"main/src_code/go_src/cmd/utils"
|
"main/src_code/go_src/cmd/utils"
|
||||||
"os"
|
"os"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@@ -26,6 +27,16 @@ var rootCmd = &cobra.Command{
|
|||||||
pflag, _ := cmd.Flags().GetBool("print")
|
pflag, _ := cmd.Flags().GetBool("print")
|
||||||
// run execute commands again as root run will not call this part
|
// run execute commands again as root run will not call this part
|
||||||
// redundant check for now but will be useful later when we add tui
|
// redundant check for now but will be useful later when we add tui
|
||||||
|
wrap_around:
|
||||||
|
switch len(args) {
|
||||||
|
case 0:
|
||||||
|
// launch the tui
|
||||||
|
sel_auth := tui.Entry()
|
||||||
|
for _, a := range sel_auth {
|
||||||
|
fmt.Println(a)
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
|
case 1:
|
||||||
if len(args) == 1 {
|
if len(args) == 1 {
|
||||||
utils.GitWrapper(args[0])
|
utils.GitWrapper(args[0])
|
||||||
if pflag {
|
if pflag {
|
||||||
@@ -33,6 +44,14 @@ var rootCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if user included -m tag and remove. Wrap around for safety's sake
|
||||||
|
if args[0] == "-m" {
|
||||||
|
args = args[1:]
|
||||||
|
goto wrap_around
|
||||||
|
}
|
||||||
|
|
||||||
// builds the commit message with the selected authors
|
// builds the commit message with the selected authors
|
||||||
message := utils.Commit(args[0], args[1:])
|
message := utils.Commit(args[0], args[1:])
|
||||||
// prints the commit message to the console if the print flag is set
|
// prints the commit message to the console if the print flag is set
|
||||||
|
|||||||
Reference in New Issue
Block a user