Documentation
¶
Overview ¶
Package config defines the global configuration for git-iter-go. Settings are resolved in priority order: default < environment variable < CLI flag, using github.com/berquerant/structconfig.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseLogLevel ¶
ParseLogLevel converts a level string (e.g. "debug", "info", "warn", "error") to slog.Level. Defaults to slog.LevelInfo if empty.
Types ¶
type Config ¶
type Config struct {
// MaxProcs is the maximum number of parallel processes.
MaxProcs int `name:"max-procs" default:"1" usage:"maximum number of parallel processes" short:"p"`
// ReposRoot is the root directory scanned for git repositories when ListRepos is empty.
ReposRoot string `name:"repos-root" default:"" usage:"root directory of local repositories" short:"r"`
// WorktreeRoot is the root directory where git worktrees are placed.
// When empty, it defaults to <repos-root>/git-worktree.
WorktreeRoot string `name:"worktree-root" default:"" usage:"root directory of git worktrees (defaults to <repos-root>/git-worktree)"`
// ListRepos is an optional shell command whose stdout lists absolute repository paths.
// When set, ReposRoot is ignored for discovery.
ListRepos string `name:"list-repos" default:"" usage:"command to list absolute paths of repositories (one per line)"`
// AbsPath controls whether grep/path-annotated output shows absolute paths (true) or paths
// relative to ReposRoot (false).
AbsPath bool `name:"abs-path" default:"false" usage:"show absolute paths in command output" short:"a"`
// FailFast aborts execution immediately when an error occurs in any repository.
FailFast bool `name:"fail-fast" default:"false" usage:"abort immediately when any repository command fails"`
// LogLevel sets the logging level (debug, info, warn, error).
LogLevel string `name:"log-level" default:"info" usage:"logging level (debug, info, warn, error)" short:"l"`
// GitCommand is the path or name of the git binary.
GitCommand string `name:"git-command" default:"git" usage:"path to git executable"`
// Timeout is the maximum execution duration for each process.
Timeout time.Duration `name:"timeout" default:"0s" usage:"timeout for each process execution (e.g. 5s, 1m)"`
// MarkdownHeaderLevel is the heading level (1-6) for repository sections in markdown output.
MarkdownHeaderLevel int `name:"markdown-header-level" default:"3" usage:"heading level for markdown sections (1-6)"`
// Sort sorts repository paths in ascending order.
Sort bool `name:"sort" default:"false" usage:"sort repository paths in ascending order"`
// SortReverse sorts repository paths in descending order.
SortReverse bool `name:"sort-reverse" default:"false" usage:"sort repository paths in descending order"`
// Limit limits the number of processed repositories to the first n repos (after sorting if applicable).
Limit int `name:"limit" default:"0" usage:"limit the number of processed repositories" short:"n"`
// DirtyOnly filters repositories to only those with uncommitted changes, staged changes, or untracked files.
DirtyOnly bool `name:"dirty-only" default:"false" usage:"only include dirty repositories" short:"d"`
// CleanOnly filters repositories to only those without uncommitted changes or untracked files.
CleanOnly bool `name:"clean-only" default:"false" usage:"only include clean repositories" short:"c"`
// RemoteURL filters repositories to only those whose origin remote URL matches the specified regex pattern.
RemoteURL string `name:"remote-url" default:"" usage:"filter repositories by origin remote URL regex pattern"`
// DefaultBranchOnly filters repositories to only those whose current branch is the default branch.
DefaultBranchOnly bool `name:"default-branch-only" default:"false" usage:"only include repositories whose current branch is the default branch"`
// NotDefaultBranchOnly filters repositories to only those whose current branch is not the default branch.
NotDefaultBranchOnly bool `` /* 127-byte string literal not displayed */
// Branch filters repositories to only those whose current branch matches the specified regex pattern.
Branch string `name:"branch" default:"" usage:"filter repositories by current branch regex pattern"`
}
Config holds all global settings for git-iter.
func Resolve ¶
Resolve builds a Config by merging: default < env < already-parsed flags. fs must already be parsed before calling Resolve.
func (*Config) GitCommandOrFallback ¶
GitCommandOrFallback returns GitCommand if set, otherwise "git".
func (*Config) WorktreeRootOrFallback ¶ added in v0.4.0
WorktreeRootOrFallback returns WorktreeRoot if set, otherwise <ReposRoot>/git-worktree when ReposRoot is non-empty, or an empty string if neither is configured.