Documentation
¶
Overview ¶
Package cmd defines all cobra commands for git-iter.
Index ¶
- Constants
- Variables
- func ConfigFromContext(ctx context.Context) *config.Config
- func FormatItems(items []Item, indent, spacing int) string
- func NewDiffCmd() *cobra.Command
- func NewDoCmd() *cobra.Command
- func NewFetchCmd() *cobra.Command
- func NewGetCmd() *cobra.Command
- func NewGrepCmd() *cobra.Command
- func NewListCmd() *cobra.Command
- func NewLsFilesCmd() *cobra.Command
- func NewMcpCmd() *cobra.Command
- func NewPullCmd() *cobra.Command
- func NewReadCmd() *cobra.Command
- func NewRootCmd() *cobra.Command
- func NewStatusCmd() *cobra.Command
- func NewVersionCmd() *cobra.Command
- func NewWorktreeAddCmd() *cobra.Command
- func NewWorktreeCmd() *cobra.Command
- func NewWorktreeListCmd() *cobra.Command
- func NewWorktreePruneCmd() *cobra.Command
- func NewWorktreeRemoveCmd() *cobra.Command
- func OutModeFromContext(ctx context.Context) string
- type DiffArgs
- type DoArgs
- type Example
- type FetchArgs
- type GetArgs
- type GrepArgs
- type Item
- type ListArgs
- type LongDoc
- type LsFilesArgs
- type OutputModeDoc
- type PullArgs
- type ReadArgs
- type Section
- type StatusArgs
- type WorktreeAddArgs
- type WorktreeListArgs
- type WorktreePruneArgs
- type WorktreeRemoveArgs
Constants ¶
const ( DefaultTextDesc = "Stream stdout/stderr of each process directly (default)." DefaultJSONDesc = "Emit one JSON object per repository (JSON Lines):" DefaultMarkdownDesc = "Emit a formatted Markdown document with summaries (or md)." JSONRowRepoAbsPath = "repo_abs_path" JSONRowRepoRelPath = "repo_rel_path" JSONRowCommand = "command" JSONRowExitCode = "exit_code" JSONRowStdout = "stdout" JSONRowStderr = "stderr" JSONRowRepoAbsPathDesc = "absolute path of the repository" JSONRowRepoRelPathDesc = "path relative to --repos-root" JSONRowStderrDesc = "captured standard error" ExampleDescJSONLines = "Collect results as JSON Lines" )
Common output mode description constants.
Variables ¶
var ( ParseDoArgs = parse.ParseDoArgs ParseDoArgsWithDash = parse.ParseDoArgsWithDash ParseGrepArgs = parse.ParseGrepArgs ParseGrepArgsWithDash = parse.ParseGrepArgsWithDash ParseListArgs = parse.ParseListArgs ParseReadArgs = parse.ParseReadArgs ParsePullArgs = parse.ParsePullArgs ParsePullArgsWithDash = parse.ParsePullArgsWithDash ParseFetchArgs = parse.ParseFetchArgs ParseFetchArgsWithDash = parse.ParseFetchArgsWithDash ParseLsFilesArgs = parse.ParseLsFilesArgs ParseLsFilesArgsWithDash = parse.ParseLsFilesArgsWithDash ParseStatusArgs = parse.ParseStatusArgs ParseStatusArgsWithDash = parse.ParseStatusArgsWithDash ParseDiffArgs = parse.ParseDiffArgs ParseDiffArgsWithDash = parse.ParseDiffArgsWithDash ParseGetArgs = parse.ParseGetArgs ParseWorktreeListArgs = parse.ParseWorktreeListArgs ParseWorktreeAddArgs = parse.ParseWorktreeAddArgs ParseWorktreeRemoveArgs = parse.ParseWorktreeRemoveArgs ParseWorktreePruneArgs = parse.ParseWorktreePruneArgs )
var ( RunDo = cmdRunner.RunDo RunRead = cmdRunner.RunRead RunList = cmdRunner.RunList RunGrep = cmdRunner.RunGrep RunPull = cmdRunner.RunPull RunFetch = cmdRunner.RunFetch RunLsFiles = cmdRunner.RunLsFiles RunStatus = cmdRunner.RunStatus RunDiff = cmdRunner.RunDiff RunGet = cmdRunner.RunGet RunWorktreeList = cmdRunner.RunWorktreeList RunWorktreeAdd = cmdRunner.RunWorktreeAdd RunWorktreeRemove = cmdRunner.RunWorktreeRemove RunWorktreePrune = cmdRunner.RunWorktreePrune )
Aliases for runner functions moved to internal/cmd/runner.
var ErrConflictingBranchFlags = fmt.Errorf("cannot specify both --default-branch-only and --not-default-branch-only")
ErrConflictingBranchFlags is returned when both --default-branch-only and --not-default-branch-only are set.
var ErrConflictingFilterFlags = fmt.Errorf("cannot specify both --dirty-only (-d) and --clean-only (-c)")
ErrConflictingFilterFlags is returned when both --dirty-only and --clean-only are set.
var ErrNoRepoSource = errors.New("either --repos-root (-r) or --list-repos must be set")
ErrNoRepoSource is returned when neither --repos-root nor --list-repos is configured.
Functions ¶
func ConfigFromContext ¶
ConfigFromContext retrieves the Config stored in ctx by NewRootCmd's PersistentPreRunE.
func FormatItems ¶
FormatItems aligns items into a 2-column list with indent and spacing.
func NewListCmd ¶
NewListCmd returns the "list" (alias: "ls") sub-command.
func NewLsFilesCmd ¶
NewLsFilesCmd returns the "ls-files" (alias: "lsf") sub-command.
func NewRootCmd ¶
NewRootCmd constructs the root cobra command with all sub-commands registered. Each call creates a fresh pflag.FlagSet so that tests can create multiple independent command trees without flag-redefinition panics.
func NewStatusCmd ¶
NewStatusCmd returns the "status" (alias: "st") sub-command.
func NewVersionCmd ¶
func NewWorktreeAddCmd ¶ added in v0.4.0
NewWorktreeAddCmd returns the "worktree add" (alias: "a") sub-command.
func NewWorktreeCmd ¶ added in v0.4.0
NewWorktreeCmd returns the "worktree" (alias: "wt") parent sub-command.
func NewWorktreeListCmd ¶ added in v0.4.0
NewWorktreeListCmd returns the "worktree list" (aliases: "ls", "l") sub-command.
func NewWorktreePruneCmd ¶ added in v0.4.0
NewWorktreePruneCmd returns the "worktree prune" (alias: "p") sub-command.
func NewWorktreeRemoveCmd ¶ added in v0.4.0
NewWorktreeRemoveCmd returns the "worktree remove" (aliases: "r", "rm") sub-command.
func OutModeFromContext ¶
OutModeFromContext retrieves the output mode ("text" or "json") from ctx. Returns "text" when not set.
Types ¶
type Example ¶
type Example struct {
Desc string // Description of what the example does (e.g. "Run git status in all repositories")
Command string // The shell command invocation (e.g. "git-iter -r /repos do -- git status")
}
Example represents a usage example consisting of a description and a command.
type Item ¶
type Item struct {
Term string // Term or name (e.g. "-d, --dirty-only", "repo_abs_path")
Desc string // Description of the item
}
Item represents a term and its description (e.g. flag or field).
type LongDoc ¶
type LongDoc struct {
// Header is the opening synopsis or description of what the subcommand does.
Header string
// RepoFilter indicates whether to include the standard REPO_REGEX filter explanation.
RepoFilter bool
// DashSeparation explains how arguments before and after "--" are separated (if applicable).
DashSeparation string
// Sections contains additional structured sections (flags, options, notes) rendered with Title/Body/Items.
Sections []Section
// ExecutionNote indicates whether to include standard notes about working directory and parallelism controls.
ExecutionNote bool
// OutputModes specifies the explanations for text, json, and markdown output formats.
OutputModes OutputModeDoc
// Examples contains command usage examples appended at the end of help text.
Examples []Example
}
LongDoc defines the structured sections of a subcommand's Long help text. Build() concatenates these sections in order with standardized formatting.
type LsFilesArgs ¶
type LsFilesArgs = parse.LsFilesArgs
Aliases for types and functions moved to internal/cmd/parse.
type OutputModeDoc ¶
type OutputModeDoc struct {
Text string // Description for text mode
JSON string // Description for json mode
JSONRows []Item // Field descriptions for json mode
Markdown string // Description for markdown/md mode
}
OutputModeDoc describes the output modes supported by a subcommand.
func DefaultOutputModeDoc ¶
func DefaultOutputModeDoc() OutputModeDoc
DefaultOutputModeDoc returns the standard output mode documentation for process-executing commands.
func RepoListOutputModeDoc ¶ added in v0.3.0
func RepoListOutputModeDoc() OutputModeDoc
RepoListOutputModeDoc returns the standard output mode documentation for repository-listing commands.
type Section ¶
type Section struct {
Title string // Section title (e.g. "Flags:", "Filter flags (global):")
Body string // Free-form body text (optional)
Items []Item // Structured key-value items with automatic alignment (optional)
}
Section represents a structured section in help documentation.
type StatusArgs ¶
type StatusArgs = parse.StatusArgs
Aliases for types and functions moved to internal/cmd/parse.
type WorktreeAddArgs ¶ added in v0.4.0
type WorktreeAddArgs = parse.WorktreeAddArgs
Aliases for types and functions moved to internal/cmd/parse.
type WorktreeListArgs ¶ added in v0.4.0
type WorktreeListArgs = parse.WorktreeListArgs
Aliases for types and functions moved to internal/cmd/parse.
type WorktreePruneArgs ¶ added in v0.4.0
type WorktreePruneArgs = parse.WorktreePruneArgs
Aliases for types and functions moved to internal/cmd/parse.
type WorktreeRemoveArgs ¶ added in v0.4.0
type WorktreeRemoveArgs = parse.WorktreeRemoveArgs
Aliases for types and functions moved to internal/cmd/parse.