summaryrefslogtreecommitdiff
path: root/internal/cli/cli.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-18 08:47:27 +0300
committerPaul Buetow <paul@buetow.org>2026-04-18 08:47:27 +0300
commit60f717b97ce6c375679080472750e60aab9dcd8f (patch)
treeb1028ea0e51ce6134ed3ea06da2a7205457319c5 /internal/cli/cli.go
parent526e3bd1bea7e2ef67c6984b91cdb9b3ac3be4e5 (diff)
refactor: move Gitter interface to consumer package internal/cli (task p6)
Per Go best practice (100 Go Mistakes #6): interfaces belong where they are used, not where they are implemented. Move Gitter from internal/git to internal/cli/git.go. Compile-time assertions (var _ Gitter = ...) kept in the new location. internal/git retains concrete *Git and *NoOp types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/cli/cli.go')
-rw-r--r--internal/cli/cli.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/cli/cli.go b/internal/cli/cli.go
index 94c9f57..01342be 100644
--- a/internal/cli/cli.go
+++ b/internal/cli/cli.go
@@ -22,7 +22,6 @@ import (
"codeberg.org/snonux/foostore/internal/backend"
"codeberg.org/snonux/foostore/internal/clipboard"
"codeberg.org/snonux/foostore/internal/config"
- "codeberg.org/snonux/foostore/internal/git"
"codeberg.org/snonux/foostore/internal/shell"
"codeberg.org/snonux/foostore/internal/store"
)
@@ -59,10 +58,11 @@ var SearchActions = map[string]store.Action{
// backend is *store.Store, which satisfies Backend via the compile-time check
// in internal/backend/backend.go.
//
-// g is declared as git.Gitter (interface) rather than *git.Git so that the
-// keepass backend can supply a git.NoOp when the kdbx file lives outside a git
-// repository. Dispatch code requires no nil checks; it always calls through the
-// interface regardless of whether real git operations or no-ops are performed.
+// g is declared as Gitter (defined in git.go in this package) rather than
+// *git.Git so that the keepass backend can supply a *git.NoOp when the kdbx
+// file lives outside a git repository. Dispatch code requires no nil checks;
+// it always calls through the interface regardless of whether real git
+// operations or no-ops are performed.
//
// effectiveBackend is the resolved backend name (after applying the --backend
// flag override on top of cfg.Backend). Guards such as cmdMigrateKDBX use
@@ -70,7 +70,7 @@ var SearchActions = map[string]store.Action{
type CLI struct {
cfg *config.Config
st backend.Backend
- g git.Gitter // real *git.Git or *git.NoOp when kdbx is outside a repo
+ g Gitter // real *git.Git or *git.NoOp when kdbx is outside a repo
clip *clipboard.Clipboard
sh *shell.Shell
openKDBX func(string, string) (KDBXStore, error)