Skip to content

Commit 5a1731b

Browse files
committed
refactor: shrink internal packages and simplify as much as possible
1 parent 4223201 commit 5a1731b

33 files changed

Lines changed: 271 additions & 514 deletions

cmd/cli/commands/init_cmd/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import (
66
)
77

88
type initCmd struct {
9-
dm *dependency.DependencyManager
9+
dm *dependency.Manager
1010
}
1111

12-
func New(dm *dependency.DependencyManager) *initCmd {
12+
func New(dm *dependency.Manager) *initCmd {
1313
return &initCmd{dm}
1414
}
1515

cmd/cli/commands/init_cmd/local.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/spf13/cobra"
1111
)
1212

13-
func localCommand(dm *dependency.DependencyManager) *cobra.Command {
13+
func localCommand(dm *dependency.Manager) *cobra.Command {
1414
return &cobra.Command{
1515
Use: "local",
1616
Short: "Use a local configuration to clone the configured repos",

cmd/cli/commands/init_cmd/remote.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func setupConfig(url, targetDir string) (string, error) {
4343
return finalPath, nil
4444
}
4545

46-
func remoteCommand(dm *dependency.DependencyManager) *cobra.Command {
46+
func remoteCommand(dm *dependency.Manager) *cobra.Command {
4747
return &cobra.Command{
4848
Use: "remote",
4949
Short: "Use a remote configuration (via URL) to clone the configured repos",

cmd/cli/commands/reset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func resetRepo(g git.Git, payload resetInputPayload) error {
4242
return g.Pull(payload.gitRepo, false)
4343
}
4444

45-
func resetFactory(dm *dependency.DependencyManager) *cobra.Command {
45+
func resetFactory(dm *dependency.Manager) *cobra.Command {
4646
var skipPull *bool
4747
cmd := &cobra.Command{
4848
Use: "reset",

cmd/cli/commands/root.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ import (
1414
"github.com/spf13/cobra"
1515
)
1616

17-
const CONFIG_PATH_ENV = "GLOCK_CONFIG_PATH"
18-
const VERSION = "0.0.1"
19-
const CONFIG_FILE_NAME = "glock.yml"
20-
const MAX_CONFIG_FILE_DEPTH = 20
17+
const (
18+
CONFIG_PATH_ENV = "GLOCK_CONFIG_PATH"
19+
VERSION = "0.0.1"
20+
CONFIG_FILE_NAME = "glock.yml"
21+
MAX_CONFIG_FILE_DEPTH = 20
22+
)
2123

2224
var rootCmd = &cobra.Command{
2325
Use: "glock",
@@ -35,7 +37,7 @@ func (w RedWriter) Write(p []byte) (n int, err error) {
3537
}
3638

3739
func ExecuteRoot() {
38-
dm := dependency.NewDependencyManager(CONFIG_PATH_ENV, CONFIG_FILE_NAME, MAX_CONFIG_FILE_DEPTH)
40+
dm := dependency.NewManager(CONFIG_PATH_ENV, CONFIG_FILE_NAME, MAX_CONFIG_FILE_DEPTH)
3941

4042
rootCmd.SetErr(RedWriter{os.Stderr})
4143
rootCmd.AddCommand(

cmd/cli/commands/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func repoRun(ctx context.Context, _ git.Git, envFilenames []string, payload star
9090
return res, nil
9191
}
9292

93-
func startFactory(dm *dependency.DependencyManager) *cobra.Command {
93+
func startFactory(dm *dependency.Manager) *cobra.Command {
9494
var filteredRepos *[]string
9595

9696
cmd := &cobra.Command{

cmd/cli/commands/status/status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (s *status) collect() []runner.Result[statusOutputPayload] {
5454
return runner.Run(statusFn, statusArgs)
5555
}
5656

57-
func NewStatus(dm *dependency.DependencyManager) *status {
57+
func NewStatus(dm *dependency.Manager) *status {
5858
s := &status{}
5959
s.g, s.err = dm.GetGit()
6060
if s.err != nil {

cmd/cli/commands/switch_cmd/switch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ type switchCmd struct {
110110
err error
111111
}
112112

113-
func New(dm *dependency.DependencyManager) *switchCmd {
113+
func New(dm *dependency.Manager) *switchCmd {
114114
scmd := &switchCmd{}
115115
scmd.g, scmd.err = dm.GetGit()
116116
if scmd.err != nil {

cmd/cli/commands/tag/tag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func createTag(g git.Git, input tagInputPayload) (tagOutputPayload, error) {
9393
return res, nil
9494
}
9595

96-
func New(dm *dependency.DependencyManager) *tagCmd {
96+
func New(dm *dependency.Manager) *tagCmd {
9797
tcmd := &tagCmd{}
9898
tcmd.g, tcmd.err = dm.GetGit()
9999
if tcmd.err != nil {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package updater
1+
package update
22

33
import (
44
"context"
@@ -8,7 +8,7 @@ import (
88
"github.com/AzraelSec/glock/internal/shell"
99
)
1010

11-
var _ Updater = bundlerUpdater{}
11+
var _ updater = bundlerUpdater{}
1212

1313
type bundlerUpdater struct{}
1414

0 commit comments

Comments
 (0)