Fix import naming
This commit is contained in:
parent
14dcb9a66e
commit
d7615a90ba
@ -3,8 +3,8 @@ package grm
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
commands2 "gitlab.com/revalus/grm/internal/commands"
|
||||
config2 "gitlab.com/revalus/grm/internal/config"
|
||||
"gitlab.com/revalus/grm/internal/commands"
|
||||
"gitlab.com/revalus/grm/internal/config"
|
||||
"gitlab.com/revalus/grm/internal/echo"
|
||||
"io"
|
||||
"sync"
|
||||
@ -13,18 +13,18 @@ import (
|
||||
const (
|
||||
AppName = "Git repository manager"
|
||||
AppDescription = "Manage your repository with simple grm"
|
||||
VERSION = "0.3.0"
|
||||
VERSION = "0.3.2"
|
||||
errNotFoundTags = "no repository was found with the specified tags"
|
||||
errNotFoundName = "no repository was found with the specified name"
|
||||
)
|
||||
|
||||
type GitRepositoryManager struct {
|
||||
cliArguments config2.CliArguments
|
||||
configuration config2.Configuration
|
||||
cliArguments config.CliArguments
|
||||
configuration config.Configuration
|
||||
}
|
||||
|
||||
func (g *GitRepositoryManager) Parse(args []string) error {
|
||||
arguments, err := config2.ParseCliArguments(AppName, AppDescription, args)
|
||||
arguments, err := config.ParseCliArguments(AppName, AppDescription, args)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v", err.Error())
|
||||
return err
|
||||
@ -42,7 +42,7 @@ func (g *GitRepositoryManager) Parse(args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
configuration, err := config2.GetRepositoryConfig(configFileContent, fileExtension)
|
||||
configuration, err := config.GetRepositoryConfig(configFileContent, fileExtension)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v", err.Error())
|
||||
return err
|
||||
@ -78,14 +78,14 @@ func (g *GitRepositoryManager) Run(w io.Writer) int {
|
||||
|
||||
if g.cliArguments.Sync && exitCode == 0 {
|
||||
echo.InfoFMsg("Synchronizing repositories")
|
||||
sync := commands2.NewSynchronizer(g.configuration.Workspace)
|
||||
sync := commands.NewSynchronizer(g.configuration.Workspace)
|
||||
g.runCommand(sync)
|
||||
echo.InfoFMsg("All repositories are synced")
|
||||
}
|
||||
|
||||
if g.cliArguments.Status && exitCode == 0 {
|
||||
echo.InfoFMsg("Current status of repositories")
|
||||
status := commands2.NewStatusChecker(g.configuration.Workspace)
|
||||
status := commands.NewStatusChecker(g.configuration.Workspace)
|
||||
g.runCommand(status)
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ func (g *GitRepositoryManager) Run(w io.Writer) int {
|
||||
return exitCode
|
||||
}
|
||||
|
||||
func describeStatus(status commands2.CommandStatus) {
|
||||
func describeStatus(status commands.CommandStatus) {
|
||||
if status.Error {
|
||||
echo.RedMessageF("Repository \"%v\": an error occurred: %v", status.Name, status.Message)
|
||||
return
|
||||
@ -109,7 +109,7 @@ func describeStatus(status commands2.CommandStatus) {
|
||||
}
|
||||
|
||||
func (g *GitRepositoryManager) limitTags() error {
|
||||
limitedTagsTmp := []config2.RepositoryConfig{}
|
||||
limitedTagsTmp := []config.RepositoryConfig{}
|
||||
|
||||
for _, item := range g.configuration.Repositories {
|
||||
if checkAnyOfItemInSlice(item.Tags, g.cliArguments.LimitToTags) {
|
||||
@ -126,14 +126,14 @@ func (g *GitRepositoryManager) limitTags() error {
|
||||
func (g *GitRepositoryManager) limitName() error {
|
||||
for _, item := range g.configuration.Repositories {
|
||||
if g.cliArguments.LimitToName == item.Name {
|
||||
g.configuration.Repositories = []config2.RepositoryConfig{item}
|
||||
g.configuration.Repositories = []config.RepositoryConfig{item}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return errors.New(errNotFoundName)
|
||||
}
|
||||
|
||||
func (g *GitRepositoryManager) runCommand(cmd commands2.Command) {
|
||||
func (g *GitRepositoryManager) runCommand(cmd commands.Command) {
|
||||
routines := make(chan struct{}, g.cliArguments.Routines)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
@ -145,7 +145,7 @@ func (g *GitRepositoryManager) runCommand(cmd commands2.Command) {
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
go func(r config2.RepositoryConfig) {
|
||||
go func(r config.RepositoryConfig) {
|
||||
defer wg.Done()
|
||||
routines <- struct{}{}
|
||||
describeStatus(cmd.Command(r))
|
||||
|
Loading…
Reference in New Issue
Block a user