Skip to content

Commit

Permalink
Merge pull request #20 from seriouspoop/19-change-package-name
Browse files Browse the repository at this point in the history
19 change package name
  • Loading branch information
seriouspoop authored Dec 27, 2024
2 parents f2dfe28 + d7e2743 commit e1c2f00
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion gogresSvc/config.go → gopushSvc/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gogresSvc
package gopushSvc

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion gogresSvc/errors.go → gopushSvc/errors.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gogresSvc
package gopushSvc

import "errors"

Expand Down
2 changes: 1 addition & 1 deletion gogresSvc/facade.go → gopushSvc/facade.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gogresSvc
package gopushSvc

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion gogresSvc/repo.go → gopushSvc/repo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gogresSvc
package gopushSvc

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion gogresSvc/svc.go → gopushSvc/svc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gogresSvc
package gopushSvc

import (
"github.com/seriouspoop/gopush/config"
Expand Down
2 changes: 1 addition & 1 deletion gogresSvc/tests.go → gopushSvc/tests.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gogresSvc
package gopushSvc

import (
"github.com/seriouspoop/gopush/utils"
Expand Down
10 changes: 5 additions & 5 deletions internal/handler/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions internal/handler/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
34 changes: 17 additions & 17 deletions internal/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand All @@ -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(`
██████╗ ██████╗ ██████╗ ██╗ ██╗ ███████╗ ██╗ ██╗
Expand Down
8 changes: 4 additions & 4 deletions utils/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit e1c2f00

Please sign in to comment.