Documentation
¶
Overview ¶
Package locations provides the application-layer service for managing gitconfig location entries. LocationManager implements the location.Service port, coordinating GitConfig for .gitconfig file I/O and afero for individual location config file management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocationManager ¶
type LocationManager struct {
// contains filtered or unexported fields
}
LocationManager orchestrates operations on the .gitconfig file (via GitConfig) and on the individual location config files.
func NewLocationManager ¶
func NewLocationManager(gitconfigPath string, fs *afero.Afero) *LocationManager
NewLocationManager creates a LocationManager that reads and writes to the given gitconfig file using the provided filesystem. When fs is nil the OS filesystem is used; when gitconfigPath is empty the user's ~/.gitconfig is used.
func (*LocationManager) DeleteLocation ¶
func (lm *LocationManager) DeleteLocation(key string) error
DeleteLocation removes the location identified by key from the gitconfig file and deletes its associated config file.
func (*LocationManager) FindLocationByKey ¶
func (lm *LocationManager) FindLocationByKey(key string) (*location.Location, error)
FindLocationByKey searches for a location by key. Returns nil, nil if not found.
func (LocationManager) GetLocations ¶
func (lm LocationManager) GetLocations() ([]location.Location, error)
GetLocations returns all configured locations found in the gitconfig file.
func (LocationManager) SaveLocation ¶
func (lm LocationManager) SaveLocation(key string, location_path string) error
SaveLocation creates a new location entry for the given key and path, or updates the existing one if the key is already present.