Documentation
¶
Overview ¶
Package cmd provides the command-line interface for the Got CLI tool. It implements Cobra commands for git repository management operations including pull, fetch, and status commands that can operate on single repositories or recursively across directory trees.
Index ¶
- Constants
- Variables
- func Execute()
- func SetGitCommandRunner(runner git.CommandRunner) git.CommandRunner
- func SimpleProgressBar(current, total int, width int) string
- type ProgressTracker
- func (pt *ProgressTracker) Finish()
- func (pt *ProgressTracker) GetGitRepoCount() int
- func (pt *ProgressTracker) GetProcessedCount() int
- func (pt *ProgressTracker) SetTotal(total int)
- func (pt *ProgressTracker) ShowMessage(message string)
- func (pt *ProgressTracker) Start()
- func (pt *ProgressTracker) Update(path string, isGitRepo bool)
- type Spinner
Constants ¶
const ( ErrorWalkingMessage = "error walking filepath [%s]" SkippingMessage = "Skipping [%s]" SuccessMessage = "[%s]: Success" ErrorMessage = "[%s]: ERROR %v" )
Constants for commonly used logging messages
const (
RecursiveFlagName = "recursive"
)
Constants for commonly used strings
Variables ¶
var RootCmd = &cobra.Command{
Use: "got",
Short: "Git repository management tool",
Long: `Got is a CLI tool for managing multiple Git repositories.
It allows you to perform git operations (pull, fetch, status) across single
repositories or recursively across directory trees containing multiple git
repositories. Use the --recursive flag to operate on all repositories found
in subdirectories.
Configuration (.got.yaml in your home directory):
skipList: ["custom_dir", "temp"] # Custom directories to skip
useDefaultSkips: true # Include defaults (node_modules, vendor, .git)
By default, common directories (node_modules, vendor, .git) are automatically
skipped. Set useDefaultSkips: false to disable this behavior.`,
}
RootCmd represents the base command when called without any subcommands
var SpinnerFrames = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}
SpinnerFrames provides spinner animation frames
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func SetGitCommandRunner ¶
func SetGitCommandRunner(runner git.CommandRunner) git.CommandRunner
SetGitCommandRunner sets the git command runner (for testing)
func SimpleProgressBar ¶
SimpleProgressBar creates a simple inline progress bar for single operations
Types ¶
type ProgressTracker ¶
type ProgressTracker struct {
// contains filtered or unexported fields
}
ProgressTracker manages progress display for operations
func NewProgressTracker ¶
func NewProgressTracker() *ProgressTracker
NewProgressTracker creates a new progress tracker
func (*ProgressTracker) Finish ¶
func (pt *ProgressTracker) Finish()
Finish completes the progress tracking
func (*ProgressTracker) GetGitRepoCount ¶
func (pt *ProgressTracker) GetGitRepoCount() int
GetGitRepoCount returns the number of git repositories found
func (*ProgressTracker) GetProcessedCount ¶
func (pt *ProgressTracker) GetProcessedCount() int
GetProcessedCount returns the number of directories processed
func (*ProgressTracker) SetTotal ¶
func (pt *ProgressTracker) SetTotal(total int)
SetTotal sets the total number of items to process
func (*ProgressTracker) ShowMessage ¶
func (pt *ProgressTracker) ShowMessage(message string)
ShowMessage temporarily displays a message without disrupting progress
func (*ProgressTracker) Update ¶
func (pt *ProgressTracker) Update(path string, isGitRepo bool)
Update updates the progress with current path