From d5ed7907652ce9cd2c757d0ea60da3799b60d448 Mon Sep 17 00:00:00 2001 From: Harshit Singh Date: Fri, 27 Dec 2024 23:29:07 +0530 Subject: [PATCH 1/2] fix: package name --- {gogresSvc => gopushSvc}/config.go | 2 +- {gogresSvc => gopushSvc}/errors.go | 2 +- {gogresSvc => gopushSvc}/facade.go | 2 +- {gogresSvc => gopushSvc}/repo.go | 2 +- {gogresSvc => gopushSvc}/svc.go | 2 +- {gogresSvc => gopushSvc}/tests.go | 2 +- internal/handler/init.go | 10 +++++----- internal/handler/run.go | 8 ++++---- internal/root.go | 32 +++++++++++++++--------------- utils/logger.go | 8 ++++---- 10 files changed, 35 insertions(+), 35 deletions(-) rename {gogresSvc => gopushSvc}/config.go (99%) rename {gogresSvc => gopushSvc}/errors.go (98%) rename {gogresSvc => gopushSvc}/facade.go (98%) rename {gogresSvc => gopushSvc}/repo.go (99%) rename {gogresSvc => gopushSvc}/svc.go (94%) rename {gogresSvc => gopushSvc}/tests.go (95%) diff --git a/gogresSvc/config.go b/gopushSvc/config.go similarity index 99% rename from gogresSvc/config.go rename to gopushSvc/config.go index 846534c..8b89d51 100644 --- a/gogresSvc/config.go +++ b/gopushSvc/config.go @@ -1,4 +1,4 @@ -package gogresSvc +package gopushSvc import ( "errors" diff --git a/gogresSvc/errors.go b/gopushSvc/errors.go similarity index 98% rename from gogresSvc/errors.go rename to gopushSvc/errors.go index eea9c0d..9b6932f 100644 --- a/gogresSvc/errors.go +++ b/gopushSvc/errors.go @@ -1,4 +1,4 @@ -package gogresSvc +package gopushSvc import "errors" diff --git a/gogresSvc/facade.go b/gopushSvc/facade.go similarity index 98% rename from gogresSvc/facade.go rename to gopushSvc/facade.go index f2a9ad8..7df27ab 100644 --- a/gogresSvc/facade.go +++ b/gopushSvc/facade.go @@ -1,4 +1,4 @@ -package gogresSvc +package gopushSvc import ( "os" diff --git a/gogresSvc/repo.go b/gopushSvc/repo.go similarity index 99% rename from gogresSvc/repo.go rename to gopushSvc/repo.go index b77dc90..f0ddbe1 100644 --- a/gogresSvc/repo.go +++ b/gopushSvc/repo.go @@ -1,4 +1,4 @@ -package gogresSvc +package gopushSvc import ( "errors" diff --git a/gogresSvc/svc.go b/gopushSvc/svc.go similarity index 94% rename from gogresSvc/svc.go rename to gopushSvc/svc.go index 51ad16b..4ac2c04 100644 --- a/gogresSvc/svc.go +++ b/gopushSvc/svc.go @@ -1,4 +1,4 @@ -package gogresSvc +package gopushSvc import ( "github.com/seriouspoop/gopush/config" diff --git a/gogresSvc/tests.go b/gopushSvc/tests.go similarity index 95% rename from gogresSvc/tests.go rename to gopushSvc/tests.go index c821cc9..dc5c877 100644 --- a/gogresSvc/tests.go +++ b/gopushSvc/tests.go @@ -1,4 +1,4 @@ -package gogresSvc +package gopushSvc import ( "github.com/seriouspoop/gopush/utils" diff --git a/internal/handler/init.go b/internal/handler/init.go index 25f8529..ba22b56 100644 --- a/internal/handler/init.go +++ b/internal/handler/init.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/MakeNowJust/heredoc/v2" - "github.com/seriouspoop/gopush/gogresSvc" + "github.com/seriouspoop/gopush/gopushSvc" "github.com/seriouspoop/gopush/utils" "github.com/spf13/cobra" ) @@ -38,7 +38,7 @@ func Init(s servicer) *cobra.Command { err = s.LoadProject() if err != nil { - if errors.Is(err, gogresSvc.ErrRepoNotFound) { + if errors.Is(err, gopushSvc.ErrRepoNotFound) { err := s.InitializeRepo() if err != nil { return err @@ -61,10 +61,10 @@ func Init(s servicer) *cobra.Command { // TODO -> seperate control flow for http and ssh err = s.SetRemoteHTTPAuth() if err != nil { - if errors.Is(err, gogresSvc.ErrInvalidAuthMethod) { + if errors.Is(err, gopushSvc.ErrInvalidAuthMethod) { err := s.SetRemoteSSHAuth() if err != nil { - if errors.Is(err, gogresSvc.ErrWaitExit) { + if errors.Is(err, gopushSvc.ErrWaitExit) { return nil } return err @@ -90,7 +90,7 @@ func Init(s servicer) *cobra.Command { utils.Logger(utils.LOG_INFO, "Pulling commits from main...") err = s.Pull(true) if err != nil { - if errors.Is(err, gogresSvc.ErrPullFailed) { + if errors.Is(err, gopushSvc.ErrPullFailed) { utils.Logger(utils.LOG_INFO, "Remote pull failed, try pulling manually.") } return err diff --git a/internal/handler/run.go b/internal/handler/run.go index f84d11f..b0fea85 100644 --- a/internal/handler/run.go +++ b/internal/handler/run.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/MakeNowJust/heredoc/v2" - "github.com/seriouspoop/gopush/gogresSvc" + "github.com/seriouspoop/gopush/gopushSvc" "github.com/seriouspoop/gopush/model" "github.com/seriouspoop/gopush/utils" "github.com/spf13/cobra" @@ -51,7 +51,7 @@ func Run(s servicer) *cobra.Command { // Load config err = s.LoadConfig() if err != nil { - if errors.Is(err, gogresSvc.ErrFileNotFound) { + if errors.Is(err, gopushSvc.ErrFileNotFound) { fmt.Println(heredoc.Doc(` Config file not found. Use "gopush init" to generate your config file. @@ -101,7 +101,7 @@ func Run(s servicer) *cobra.Command { utils.Logger(utils.LOG_INFO, "Pulling remote changes...") err = s.Pull(false) if err != nil { - if errors.Is(err, gogresSvc.ErrAuthNotFound) { + if errors.Is(err, gopushSvc.ErrAuthNotFound) { fmt.Println(heredoc.Doc(` Auth credentials for current remote not found. Use "gopush init" to generate your config file. @@ -114,7 +114,7 @@ func Run(s servicer) *cobra.Command { utils.Logger(utils.LOG_INFO, "Pushing changes...") err = s.Push(setUpstreamBranch) if err != nil { - if errors.Is(err, gogresSvc.ErrAuthNotFound) { + if errors.Is(err, gopushSvc.ErrAuthNotFound) { fmt.Println(heredoc.Doc(` Auth credentials for current remote are missing. Run "gopush init" to setup auth credentials. diff --git a/internal/root.go b/internal/root.go index 4723b88..ceb3905 100644 --- a/internal/root.go +++ b/internal/root.go @@ -2,7 +2,7 @@ package internal import ( "github.com/MakeNowJust/heredoc/v2" - "github.com/seriouspoop/gopush/gogresSvc" + "github.com/seriouspoop/gopush/gopushSvc" "github.com/seriouspoop/gopush/internal/handler" "github.com/seriouspoop/gopush/repo/git" "github.com/seriouspoop/gopush/repo/script" @@ -12,33 +12,33 @@ import ( type Root struct { git *git.Git bash *script.Bash - s *gogresSvc.Svc + s *gopushSvc.Svc } func NewRoot() (*Root, error) { gitHelper, err := git.New(&git.Errors{ - RemoteNotFound: gogresSvc.ErrRemoteNotFound, - RemoteNotLoaded: gogresSvc.ErrRemoteNotLoaded, - RemoteAlreadyExists: gogresSvc.ErrRemoteAlreadyExists, - RepoAlreadyExists: gogresSvc.ErrRepoAlreadyExists, - RepoNotFound: gogresSvc.ErrRepoNotFound, - PullFailed: gogresSvc.ErrPullFailed, - AuthNotFound: gogresSvc.ErrAuthNotFound, - InvalidAuthMethod: gogresSvc.ErrInvalidAuthMethod, - InvalidPassphrase: gogresSvc.ErrInvalidPassphrase, - KeyNotSupported: gogresSvc.ErrKeyNotSupported, - AlreadyUpToDate: gogresSvc.ErrAlreadyUpToDate, - RemoteBranchNotFound: gogresSvc.ErrRemoteBranchNotFound, + RemoteNotFound: gopushSvc.ErrRemoteNotFound, + RemoteNotLoaded: gopushSvc.ErrRemoteNotLoaded, + RemoteAlreadyExists: gopushSvc.ErrRemoteAlreadyExists, + RepoAlreadyExists: gopushSvc.ErrRepoAlreadyExists, + RepoNotFound: gopushSvc.ErrRepoNotFound, + PullFailed: gopushSvc.ErrPullFailed, + AuthNotFound: gopushSvc.ErrAuthNotFound, + InvalidAuthMethod: gopushSvc.ErrInvalidAuthMethod, + InvalidPassphrase: gopushSvc.ErrInvalidPassphrase, + KeyNotSupported: gopushSvc.ErrKeyNotSupported, + AlreadyUpToDate: gopushSvc.ErrAlreadyUpToDate, + RemoteBranchNotFound: gopushSvc.ErrRemoteBranchNotFound, }) if err != nil { return nil, err } bashHelper := script.New(&script.Error{ - FileNotExists: gogresSvc.ErrFileNotFound, + FileNotExists: gopushSvc.ErrFileNotFound, }) - s := gogresSvc.New(gitHelper, bashHelper) + s := gopushSvc.New(gitHelper, bashHelper) return &Root{ git: gitHelper, diff --git a/utils/logger.go b/utils/logger.go index 91081b5..d523259 100644 --- a/utils/logger.go +++ b/utils/logger.go @@ -25,9 +25,9 @@ const ( func Logger(s log, msg string) { statusToUnicode := map[log]string{ LOG_INFO: "", - LOG_STRICT_INFO: green(">>"), - LOG_SUCCESS: green("\U00002714"), - LOG_FAILURE: red("\U00002718"), + LOG_STRICT_INFO: green(">> "), + LOG_SUCCESS: green("\U00002714 "), + LOG_FAILURE: red("\U00002718 "), } if s == LOG_STRICT_INFO { @@ -38,7 +38,7 @@ func Logger(s log, msg string) { msg = faint(msg) } - fmt.Printf("%s %s\n", statusToUnicode[s], msg) + fmt.Printf("%s%s\n", statusToUnicode[s], msg) } func ErrorSymbol() string { From d7e2743a644e07c7e0b56e5155954db4eed8a8c6 Mon Sep 17 00:00:00 2001 From: Harshit Singh Date: Fri, 27 Dec 2024 23:30:03 +0530 Subject: [PATCH 2/2] chore: update version --- internal/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/root.go b/internal/root.go index ceb3905..a4665bf 100644 --- a/internal/root.go +++ b/internal/root.go @@ -50,7 +50,7 @@ func NewRoot() (*Root, error) { func (r *Root) RootCMD() *cobra.Command { rootCMD := &cobra.Command{ Use: "gopush", - Version: "1.1.3", + Version: "1.1.4", Short: heredoc.Doc(` ██████╗ ██████╗ ██████╗ ██╗ ██╗ ███████╗ ██╗ ██╗