This repository has been archived on 2026-10-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
submarine/internal/submodule/provider.go
T
simonfrankenandClaude Sonnet 5.5 5cb809428b Add c to copy the selected path, split key bar into groups
c copies the absolute directory of the selected submodule via OSC 52.
Keys are grouped into navigation (footer left), global (footer right)
and submodule (detail pane palette, footer if the pane can't show it).
Adds a key reference table to the UX guide.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 20:48:16 +02:00

42 lines
1.5 KiB
Go

package submodule
import "context"
// Provider supplies repository data. Tree is expected to be fast (structure
// only); Status may be slow and is called once per submodule, concurrently.
type Provider interface {
Tree(ctx context.Context) (*Repo, error)
Status(ctx context.Context, path string) (*Status, error)
}
// Fetcher is implemented by providers that can download remote refs. Path
// "" is the superproject. Fetch must be safe to call concurrently and must
// never prompt the user.
type Fetcher interface {
// Fetchable reports whether path is a repository that can be fetched
// (e.g. not an uninitialized submodule).
Fetchable(path string) bool
Fetch(ctx context.Context, path string) error
}
// Watcher is implemented by providers that notice changes made outside the
// application, e.g. a fetch or commit in another shell. The channel is
// closed when ctx is done.
type Watcher interface {
Watch(ctx context.Context) <-chan Change
}
// Locator is implemented by providers whose submodules live on the local
// disk. Dir returns the absolute directory of path ("" is the superproject),
// or "" if it is unknown.
type Locator interface {
Dir(path string) string
}
// Change reports that the git metadata of a repository changed.
type Change struct {
Path string // "" is the superproject
Local bool // HEAD, index or local branches changed, not only remote refs
Structure bool // .gitmodules changed: submodules may have been added or removed
}