From 2b75245d3c3bbd3be356230341a62508e04d5d14 Mon Sep 17 00:00:00 2001 From: daveberrys <84567826+daveberrys@users.noreply.github.com> Date: Wed, 15 Jul 2026 22:25:54 +0800 Subject: [PATCH] code cleanup, implement init repo --- src/cmd/diff.go | 4 +--- src/cmd/init.go | 17 +++++++++++++++++ src/cmd/pull.go | 4 +--- src/cmd/push.go | 4 +--- src/cmd/stash.go | 4 +--- 5 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 src/cmd/init.go diff --git a/src/cmd/diff.go b/src/cmd/diff.go index 367f960..c9ebb92 100644 --- a/src/cmd/diff.go +++ b/src/cmd/diff.go @@ -5,9 +5,7 @@ import ( "github.com/spf13/cobra" ) -func init() { - rootCmd.AddCommand(diffCmd) -} +func init() { rootCmd.AddCommand(diffCmd) } var diffCmd = &cobra.Command{ Use: "diff", diff --git a/src/cmd/init.go b/src/cmd/init.go new file mode 100644 index 0000000..fba9b3e --- /dev/null +++ b/src/cmd/init.go @@ -0,0 +1,17 @@ +package cmd + +import ( + "github.com/daveberrys/guh/src/utils" + "github.com/spf13/cobra" +) + +func init() { rootCmd.AddCommand(initCmd) } + +var initCmd = &cobra.Command{ + Use: "init", + Short: "Initialize a new repository", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + return utils.RunGitSequence(false, []string{"init"}) + }, +} diff --git a/src/cmd/pull.go b/src/cmd/pull.go index 696d171..aeb9dce 100644 --- a/src/cmd/pull.go +++ b/src/cmd/pull.go @@ -5,9 +5,7 @@ import ( "github.com/spf13/cobra" ) -func init() { - rootCmd.AddCommand(pullCmd) -} +func init() { rootCmd.AddCommand(pullCmd) } var pullCmd = &cobra.Command{ Use: "pull", diff --git a/src/cmd/push.go b/src/cmd/push.go index b356976..2342f38 100644 --- a/src/cmd/push.go +++ b/src/cmd/push.go @@ -5,9 +5,7 @@ import ( "github.com/spf13/cobra" ) -func init() { - rootCmd.AddCommand(pushCmd) -} +func init() { rootCmd.AddCommand(pushCmd) } var pushCmd = &cobra.Command{ Use: "push", diff --git a/src/cmd/stash.go b/src/cmd/stash.go index 9b71826..e319107 100644 --- a/src/cmd/stash.go +++ b/src/cmd/stash.go @@ -5,9 +5,7 @@ import ( "github.com/spf13/cobra" ) -func init() { - rootCmd.AddCommand(stashCmd) -} +func init() { rootCmd.AddCommand(stashCmd) } var stashCmd = &cobra.Command{ Use: "stash",