infra

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BeeepRepoStatusNotifier = &beeepRepoStatusNotifier{}
View Source
var FilesystemRepos domain.GetReposByPathPattern = func(patterns domain.GetPathPatterns) (repos []string, err error) {
	pathPatterns, err := patterns()
	if err != nil {
		return
	}
	for _, pathPattern := range pathPatterns {
		if strings.HasSuffix(string(pathPattern), "/**") {
			path := strings.TrimSuffix(string(pathPattern), "/**")
			dirs, err := searchForGitDirs(path)
			if err != nil {
				return repos, err
			}
			repos = append(repos, dirs...)
		}
		paths, err := filepath.Glob(string(pathPattern))
		if err != nil {
			return repos, err
		}
		for _, path := range paths {
			isDir, _ := isDirectory(path + "/.git")
			if isDir {
				repos = append(repos, path)
			}
		}
	}
	return
}
View Source
var GetGitStatus domain.GetGitStatus = func(repo string) (status domain.GitStatus, err error) {
	output, err := git.Status(repo)
	if err != nil {
		return
	}
	hasAheadCommits := hasAheadCommits(output)
	hasUncommittedFiles := hasUncommittedFiles(output)
	if hasUncommittedFiles && hasAheadCommits {
		return domain.NeedToCommitAndPush, err
	} else if hasAheadCommits {
		return domain.NeedToPush, err
	} else if hasUncommittedFiles {
		return domain.NeedToCommit, err
	} else {
		return domain.UpToDate, err
	}
}
View Source
var GitGlobalConfigGetPathPatterns domain.GetPathPatterns = func() (pathPatterns []string, err error) {
	paths, err := git.GetGlobalConfig("remind.paths")
	if err != nil {
		return
	}
	pathPatterns = strings.Split(paths, ",")
	return
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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