gitConfig

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gitConfig provides wrappers around common git configuration commands as refactored from git-mob/src/git-commands.js

Index

Constants

View Source
const (
	EnvKeyCoauthorsPath = "GITMOB_COAUTHORS_PATH"
)

Variables

View Source
var (
	GlobalConfigFilePath string
)

Functions

func Add

func Add(key string, value string) error

Add adds a new line to the option without altering any existing values.

func AddGlobal

func AddGlobal(key string, value string) error

AddGlobal adds a new line to the global option without altering any existing values.

func Get

func Get(key string) string

Get gets the (last) value for the given option key.

func GetAll

func GetAll(key string) ([]string, error)

GetAll gets all values for a multi-valued option key.

func GetAllGlobal

func GetAllGlobal(key string) ([]string, error)

GetAllGlobal gets all values for a multi-valued option key.

func GetGlobal

func GetGlobal(key string) string

GetGlobal gets the (last) global value for the given option key.

func GetLocal

func GetLocal(key string) string

GetLocal gets the (last) local value for the given option key.

func Has

func Has(key string) bool

Has checks if the given option exists in the merged configuration.

func HasGlobal

func HasGlobal(key string) bool

HasGlobal checks if the given option exists in the global configuration.

func HasLocal

func HasLocal(key string) bool

HasLocal checks if the given option exists in the local configuration.

func ReadAllCoAuthorsFromFile

func ReadAllCoAuthorsFromFile() (map[string]authors.Author, error)

func Remove

func Remove(key string) error

Remove removes the given key from the configuration.

func RemoveAll

func RemoveAll(key string) error

RemoveAll removes all the given keys from the configuration.

func RemoveAllGlobal

func RemoveAllGlobal(key string) error

RemoveAllGlobal removes all the given keys from the configuration.

func RemoveGlobal

func RemoveGlobal(key string) error

RemoveGlobal removes the given key from the configuration.

func RemoveSection

func RemoveSection(key string) error

RemoveSection removes the given section from the configuration.

func RemoveSectionGlobal

func RemoveSectionGlobal(key string) error

RemoveSectionGlobal removes the given section from the global configuration.

func Set

func Set(key string, value string) error

Set sets the option, overwriting the existing value if one exists.

func SetGlobal

func SetGlobal(key string, value string) error

SetGlobal sets the global option, overwriting the existing value if one exists.

Types

type ExitCode added in v0.7.2

type ExitCode int

ExitCode of the `git config` command.

const (
	UnknownExitCode ExitCode = iota - 1
	CommandSuccess           // 0
	SectionOrKeyIsInvalid
	SectionOrNameNotProvided
	FileIsInvalid
	FileCannotBeWritten
	CannotUnsetOptionWhichDoesNotExist
	CannotUnsetSetMultipleLinesMatched
	InvalidRegexp
)

ExitCodes

func (ExitCode) Errorf added in v0.7.2

func (c ExitCode) Errorf(err error) error

Errorf wraps an error with the known interpretation from git

func (ExitCode) IsKnown added in v0.7.2

func (c ExitCode) IsKnown() bool

func (ExitCode) String added in v0.7.2

func (c ExitCode) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL