From 98c933a0b606447a250bc8772b5482116e20f5b0 Mon Sep 17 00:00:00 2001 From: Gorbunov Kirill Andreevich Date: Sat, 23 Mar 2024 19:53:12 +0300 Subject: [PATCH] #8 add list. --- cmd/pkgdashcli/main.go | 2 +- go.mod | 5 ----- internal/cli/delete.go | 7 +++---- internal/cli/root.go | 6 +++--- internal/cli/update.go | 12 +++++------- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/cmd/pkgdashcli/main.go b/cmd/pkgdashcli/main.go index 674ac7e..4afbaae 100644 --- a/cmd/pkgdashcli/main.go +++ b/cmd/pkgdashcli/main.go @@ -64,7 +64,7 @@ type Data struct { Modules map[string]modules.Update } -func main() { +func pkgdashcli() { var err error ctx, cancel := context.WithCancel(context.Background()) diff --git a/go.mod b/go.mod index 9cfffe8..e1e0f2b 100644 --- a/go.mod +++ b/go.mod @@ -2,11 +2,6 @@ module git.unistack.org/unistack-org/pkgdash go 1.20 -replace ( - go.unistack.org/micro-config-file/v4 v4.0.3 => /Users/kgorbunov/GolandProjects/src/micro-config-file - go.unistack.org/micro/v4 v4.0.18 => /Users/kgorbunov/GolandProjects/src/micro -) - require ( github.com/envoyproxy/protoc-gen-validate v1.0.4 github.com/go-git/go-git/v5 v5.8.1 diff --git a/internal/cli/delete.go b/internal/cli/delete.go index b152c83..44bfaf1 100644 --- a/internal/cli/delete.go +++ b/internal/cli/delete.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/cobra" ) -// deleteCmd represents the delete command var deleteCmd = NewDeleteCommand() type DeleteFlags struct { @@ -23,7 +22,7 @@ func init() { } func NewDeleteCommand() *cobra.Command { - var flags UpdateFlags + var flags DeleteFlags ctx := context.Background() @@ -68,8 +67,8 @@ func NewDeleteCommand() *cobra.Command { }, } - deleteCmd.Flags().BoolVarP(&flags.all, "all", "a", false, "Deletes everything depending") - deleteCmd.Flags().StringVarP(&flags.mod, "mod", "m", "", "Deletes one dependency") + cmd.Flags().BoolVarP(&flags.all, "all", "a", false, "Deletes everything depending") + cmd.Flags().StringVarP(&flags.mod, "mod", "m", "", "Deletes one dependency") return cmd } diff --git a/internal/cli/root.go b/internal/cli/root.go index b700289..e98e955 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -20,9 +20,9 @@ var ( // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ - Use: "pkgdash [flags]", - Short: "Pkgdash application to update dependencies.", - Long: `Pkgdash allows you to define a version update for a dependency and start merge requests in version control systems.`, + Use: "pkgdashcli [flags]", + Short: "Pkgdashcli application to update dependencies.", + Long: `Pkgdashcli allows you to define a version update for a dependency and start merge requests in version control systems.`, // Uncomment the following line if your bare application // has an action associated with it: // Run: func(cmd *cobra.Command, args []string) { }, diff --git a/internal/cli/update.go b/internal/cli/update.go index 279db50..4fd950e 100644 --- a/internal/cli/update.go +++ b/internal/cli/update.go @@ -11,7 +11,6 @@ import ( "go.unistack.org/micro/v4/logger" ) -// updateCmd represents the update command var updateCmd = NewUpdateCommand() type UpdateFlags struct { @@ -28,14 +27,13 @@ func NewUpdateCommand() *cobra.Command { ctx := context.Background() - logger.Info(ctx, "update start") cmd := &cobra.Command{ Use: "update", Short: "Update allows you to start the process of creating a PR in the repository", Long: ` -Update allows you to start the process of creating a PR in the repository. -Use the -a flag to update all dependencies or -m flag a specific module. -`, + Update allows you to start the process of creating a PR in the repository. + Use the -a flag to update all dependencies or -m flag a specific module. + `, RunE: func(cmd *cobra.Command, args []string) error { var err error @@ -90,8 +88,8 @@ Use the -a flag to update all dependencies or -m flag a specific module. }, } - updateCmd.Flags().BoolVarP(&flags.all, "all", "a", false, "Updates everything depending") - updateCmd.Flags().StringVarP(&flags.mod, "mod", "m", "", "Update one dependency") + cmd.Flags().BoolVarP(&flags.all, "all", "a", false, "Updates everything depending") + cmd.Flags().StringVarP(&flags.mod, "mod", "m", "", "Update one dependency") return cmd }