[go: up one dir, main page]

Skip to content

Commit

Permalink
refactor!: move all not-intended-for-the-public dirs into ./internal
Browse files Browse the repository at this point in the history
BREAKING CHANGE: removes all public code except for pkg/parser
  • Loading branch information
SKalt committed Apr 20, 2024
1 parent c380c85 commit 43cf8e4
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/spf13/cobra"

"github.com/skalt/git-cc/pkg/config"
"github.com/skalt/git-cc/internal/config"
"github.com/skalt/git-cc/pkg/parser"
)

Expand Down
10 changes: 5 additions & 5 deletions cmd/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"strings"

tea "github.com/charmbracelet/bubbletea"
"github.com/skalt/git-cc/pkg/breaking_change_input"
"github.com/skalt/git-cc/pkg/config"
"github.com/skalt/git-cc/pkg/description_editor"
"github.com/skalt/git-cc/internal/breaking_change_input"
"github.com/skalt/git-cc/internal/config"
"github.com/skalt/git-cc/internal/description_editor"
"github.com/skalt/git-cc/internal/scope_selector"
"github.com/skalt/git-cc/internal/type_selector"
"github.com/skalt/git-cc/pkg/parser"
"github.com/skalt/git-cc/pkg/scope_selector"
"github.com/skalt/git-cc/pkg/type_selector"
)

type componentIndex int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/muesli/termenv"
"github.com/skalt/git-cc/pkg/config"
"github.com/skalt/git-cc/pkg/helpbar"
"github.com/skalt/git-cc/internal/config"
"github.com/skalt/git-cc/internal/helpbar"
)

type Model struct {
Expand Down
7 changes: 7 additions & 0 deletions pkg/config/cfg.go → internal/config/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ func FindCCConfigFile(gitRepoRoot string) (string, []string, error) {
// "package.json",
// "pyproject.toml",
}
var alternate string
dirsToSearch := make([]string, 0, 3)

cwd, err := filepath.Abs(".")
Expand Down Expand Up @@ -525,6 +526,12 @@ func FindCCConfigFile(gitRepoRoot string) (string, []string, error) {
} else {
tried = append(tried, configFile)
}
wrongName := strings.ReplaceAll(candidate, "_", "-")
_, wrongNotPresent := os.Stat(path.Join(dir, wrongName))
if wrongNotPresent == nil && alternate != "" {
// warn about the wrong name
fmt.Printf("found %s, but expected %s\n", wrongName, candidate)
}
}
}
return "", tried, fmt.Errorf("no configuration found in \n - %s", strings.Join(tried, "\n - "))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/muesli/reflow/ansi"
"github.com/muesli/reflow/wordwrap"
"github.com/muesli/termenv"
"github.com/skalt/git-cc/pkg/config"
"github.com/skalt/git-cc/pkg/helpbar"
"github.com/skalt/git-cc/internal/config"
"github.com/skalt/git-cc/internal/helpbar"
)

const prePrompt = "A short description of the changes:"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

"github.com/atotto/clipboard"
tea "github.com/charmbracelet/bubbletea"
"github.com/skalt/git-cc/pkg/config"
"github.com/skalt/git-cc/pkg/helpbar"
"github.com/skalt/git-cc/internal/config"
"github.com/skalt/git-cc/internal/helpbar"
"github.com/skalt/git-cc/internal/single_select"
"github.com/skalt/git-cc/pkg/parser"
"github.com/skalt/git-cc/pkg/single_select"
)

const newScopeTemplate = "description of what short-form `%s` represents"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"strings"

tea "github.com/charmbracelet/bubbletea"
"github.com/skalt/git-cc/pkg/config"
"github.com/skalt/git-cc/pkg/helpbar"
"github.com/skalt/git-cc/internal/config"
"github.com/skalt/git-cc/internal/helpbar"
"github.com/skalt/git-cc/internal/single_select"
"github.com/skalt/git-cc/pkg/parser"
"github.com/skalt/git-cc/pkg/single_select"
)

type Model struct {
Expand Down

0 comments on commit 43cf8e4

Please sign in to comment.