cmd

package
v5.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Package cmd provides command implementations for the ggc CLI tool.

Index

Constants

This section is empty.

Variables

View Source
var NewCompleter = func(client git.Clienter) *Completer {
	return &Completer{
		gitClient: client,
	}
}

NewCompleter creates a new Completer.

Functions

func InteractiveUI

func InteractiveUI(gitClient git.Clienter) []string

InteractiveUI provides an incremental search interactive UI with custom git client. Returns the selected command as []string (nil if nothing selected)

func SetVersionGetter

func SetVersionGetter(getter VersionGetter)

SetVersionGetter sets the version getter function

Types

type ANSIColors

type ANSIColors struct {
	// Basic colors (0-7)
	Black   string
	Red     string
	Green   string
	Yellow  string
	Blue    string
	Magenta string
	Cyan    string
	White   string

	// Bright colors (8-15)
	BrightBlack   string // Gray
	BrightRed     string
	BrightGreen   string
	BrightYellow  string
	BrightBlue    string
	BrightMagenta string
	BrightCyan    string
	BrightWhite   string

	// Text attributes
	Bold      string
	Underline string
	Reverse   string
	Reset     string
}

ANSIColors defines color codes for terminal output

func NewANSIColors

func NewANSIColors() *ANSIColors

NewANSIColors creates a new ANSIColors instance

type Adder

type Adder struct {
	// contains filtered or unexported fields
}

Adder provides functionality for the add command.

func NewAdder

func NewAdder(client git.Clienter) *Adder

NewAdder creates a new Adder.

func (*Adder) Add

func (a *Adder) Add(args []string)

Add executes the add command with the given arguments.

type Brancher

type Brancher struct {
	// contains filtered or unexported fields
}

Brancher provides functionality for the branch command.

func NewBrancher

func NewBrancher(client git.Clienter) *Brancher

NewBrancher creates a new Brancher.

func (*Brancher) Branch

func (b *Brancher) Branch(args []string)

Branch executes the branch command with the given arguments.

type Cleaner

type Cleaner struct {
	// contains filtered or unexported fields
}

Cleaner provides functionality for the clean command.

func NewCleaner

func NewCleaner(client git.Clienter) *Cleaner

NewCleaner creates a new Cleaner.

func (*Cleaner) Clean

func (c *Cleaner) Clean(args []string)

Clean executes the clean command with the given arguments.

func (*Cleaner) CleanInteractive

func (c *Cleaner) CleanInteractive()

CleanInteractive interactively selects files to clean.

type Cmd

type Cmd struct {
	// contains filtered or unexported fields
}

Cmd represents the command-line interface.

func NewCmd

func NewCmd(client git.Clienter) *Cmd

NewCmd creates a new Cmd with the provided git client.

func (*Cmd) Add

func (c *Cmd) Add(args []string)

Add executes the add command with the given arguments.

func (*Cmd) Branch

func (c *Cmd) Branch(args []string)

Branch executes the branch command with the given arguments.

func (*Cmd) Clean

func (c *Cmd) Clean(args []string)

Clean executes the clean command with the given arguments.

func (*Cmd) Commit

func (c *Cmd) Commit(args []string)

Commit executes the commit command with the given arguments.

func (*Cmd) Config

func (c *Cmd) Config(args []string)

Config executes the status command with the given arguments.

func (*Cmd) Diff

func (c *Cmd) Diff(args []string)

Diff executes the diff command with the given arguments.

func (*Cmd) Fetch

func (c *Cmd) Fetch(args []string)

Fetch executes the fetch command with the given arguments.

func (*Cmd) Help

func (c *Cmd) Help()

Help displays help information.

func (*Cmd) Hook

func (c *Cmd) Hook(args []string)

Hook executes the hook command with the given arguments.

func (*Cmd) Interactive

func (c *Cmd) Interactive()

Interactive starts the interactive UI mode.

func (*Cmd) Log

func (c *Cmd) Log(args []string)

Log executes the log command with the given arguments.

func (*Cmd) Pull

func (c *Cmd) Pull(args []string)

Pull executes the pull command with the given arguments.

func (*Cmd) Push

func (c *Cmd) Push(args []string)

Push executes the push command with the given arguments.

func (*Cmd) Rebase

func (c *Cmd) Rebase(args []string)

Rebase executes the rebase command with the given arguments.

func (*Cmd) Remote

func (c *Cmd) Remote(args []string)

Remote executes the remote command with the given arguments.

func (*Cmd) Reset

func (c *Cmd) Reset(args []string)

Reset executes the reset command.

func (*Cmd) Restore

func (c *Cmd) Restore(args []string)

Restore executes the restore command with the given arguments.

func (*Cmd) Route

func (c *Cmd) Route(args []string)

Route routes the command to the appropriate handler based on args.

func (*Cmd) Stash

func (c *Cmd) Stash(args []string)

Stash executes the stash command with the given arguments.

func (*Cmd) Status

func (c *Cmd) Status(args []string)

Status executes the status command with the given arguments.

func (*Cmd) Tag

func (c *Cmd) Tag(args []string)

Tag executes the tag command with the given arguments.

func (*Cmd) Version

func (c *Cmd) Version(args []string)

Version executes the version command with the given arguments.

type CommandInfo

type CommandInfo struct {
	Command     string
	Description string
}

CommandInfo contains the name and description of the command

type Committer

type Committer struct {
	// contains filtered or unexported fields
}

Committer provides functionality for the commit command.

func NewCommitter

func NewCommitter(client git.Clienter) *Committer

NewCommitter creates a new Committer.

func (*Committer) Commit

func (c *Committer) Commit(args []string)

Commit executes the commit command with the given arguments.

type Completer

type Completer struct {
	// contains filtered or unexported fields
}

Completer handles dynamic completion for subcommands/args

func (*Completer) Complete

func (c *Completer) Complete(args []string)

Complete provides completion for various subcommands.

type Configurer added in v5.0.3

type Configurer struct {
	// contains filtered or unexported fields
}

Configurer handles config operations.

func NewConfigurer added in v5.0.3

func NewConfigurer(client git.Clienter) *Configurer

NewConfigurer creates a new Configurer instance.

func (*Configurer) Config added in v5.0.3

func (c *Configurer) Config(args []string)

Config executes config command operations with the given arguments.

func (*Configurer) LoadConfig added in v5.0.3

func (c *Configurer) LoadConfig() *config.Manager

LoadConfig executes loads the configuration.

type Differ

type Differ struct {
	// contains filtered or unexported fields
}

Differ handles git diff operations.

func NewDiffer

func NewDiffer(client git.Clienter) *Differ

NewDiffer creates a new Differ instance.

func (*Differ) Diff

func (d *Differ) Diff(args []string)

Diff executes git diff with the given arguments.

type Executer

type Executer interface {
	Help()
	Branch(args []string)
	Commit(args []string)
	Log(args []string)
	Pull(args []string)
	Push(args []string)
	Reset(args []string)
	Diff(args []string)
	Config(args []string)
	Hook(args []string)
	Rebase(args []string)
	Remote(args []string)
	Version(args []string)
	Stash(args []string)
	Fetch(args []string)
	Status(args []string)
	Tag(args []string)
	Clean(args []string)
	Restore(args []string)
	Add(args []string)
	Interactive()
}

Executer is an interface for executing commands.

type Fetcher

type Fetcher struct {
	// contains filtered or unexported fields
}

Fetcher handles git fetch operations.

func NewFetcher

func NewFetcher(client git.Clienter) *Fetcher

NewFetcher creates a new Fetcher instance.

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(args []string)

Fetch executes git fetch with the given arguments.

type GitStatus

type GitStatus struct {
	Branch     string
	Modified   int
	Staged     int
	Ahead      int
	Behind     int
	HasChanges bool
}

GitStatus represents the current Git repository status

type Helper

type Helper struct {
	// contains filtered or unexported fields
}

Helper provides help message functionality.

func NewHelper

func NewHelper() *Helper

NewHelper creates a new Helper.

func (*Helper) ShowAddHelp

func (h *Helper) ShowAddHelp()

ShowAddHelp shows help message for add command.

func (*Helper) ShowBranchHelp

func (h *Helper) ShowBranchHelp()

ShowBranchHelp shows help message for branch command.

func (*Helper) ShowCleanHelp

func (h *Helper) ShowCleanHelp()

ShowCleanHelp shows help message for clean command.

func (*Helper) ShowCommandHelp

func (h *Helper) ShowCommandHelp(data templates.HelpData)

ShowCommandHelp shows help message for a command.

func (*Helper) ShowCommitHelp

func (h *Helper) ShowCommitHelp()

ShowCommitHelp shows help message for commit command.

func (*Helper) ShowConfigHelp

func (h *Helper) ShowConfigHelp()

ShowConfigHelp shows help message for config command.

func (*Helper) ShowDeleteBranchHelp

func (h *Helper) ShowDeleteBranchHelp()

ShowDeleteBranchHelp displays help for the delete branch command.

func (*Helper) ShowDeleteMergedBranchHelp

func (h *Helper) ShowDeleteMergedBranchHelp()

ShowDeleteMergedBranchHelp displays help for the delete merged branch command.

func (*Helper) ShowDiffHelp

func (h *Helper) ShowDiffHelp()

ShowDiffHelp displays help for the git diff command.

func (*Helper) ShowFetchHelp

func (h *Helper) ShowFetchHelp()

ShowFetchHelp shows help message for fetch command.

func (*Helper) ShowHelp

func (h *Helper) ShowHelp()

ShowHelp shows the main help message.

func (*Helper) ShowHookHelp

func (h *Helper) ShowHookHelp()

ShowHookHelp displays help information for hook commands.

func (*Helper) ShowListBranchesHelp

func (h *Helper) ShowListBranchesHelp()

ShowListBranchesHelp displays help for the list branches command.

func (*Helper) ShowLogHelp

func (h *Helper) ShowLogHelp()

ShowLogHelp shows help message for log command.

func (*Helper) ShowPullHelp

func (h *Helper) ShowPullHelp()

ShowPullHelp shows help message for pull command.

func (*Helper) ShowPushHelp

func (h *Helper) ShowPushHelp()

ShowPushHelp shows help message for push command.

func (*Helper) ShowRebaseHelp

func (h *Helper) ShowRebaseHelp()

ShowRebaseHelp shows help message for rebase command.

func (*Helper) ShowRemoteHelp

func (h *Helper) ShowRemoteHelp()

ShowRemoteHelp shows help message for remote command.

func (*Helper) ShowResetHelp

func (h *Helper) ShowResetHelp()

ShowResetHelp shows help message for reset command.

func (*Helper) ShowRestoreHelp

func (h *Helper) ShowRestoreHelp()

ShowRestoreHelp shows help message for restore command.

func (*Helper) ShowStashHelp

func (h *Helper) ShowStashHelp()

ShowStashHelp shows help message for stash command.

func (*Helper) ShowStatusHelp

func (h *Helper) ShowStatusHelp()

ShowStatusHelp shows help message for status command.

func (*Helper) ShowTagHelp

func (h *Helper) ShowTagHelp()

ShowTagHelp shows help message for tag command.

func (*Helper) ShowVersionHelp

func (h *Helper) ShowVersionHelp()

ShowVersionHelp shows help message for Version command.

type Hooker

type Hooker struct {
	// contains filtered or unexported fields
}

Hooker handles git hook operations.

func NewHooker

func NewHooker(client git.Clienter) *Hooker

NewHooker creates a new Hooker instance.

func (*Hooker) Hook

func (h *Hooker) Hook(args []string)

Hook executes git hook commands with the given arguments.

type KeyHandler

type KeyHandler struct {
	// contains filtered or unexported fields
}

KeyHandler manages keyboard input processing

func (*KeyHandler) HandleKey

func (h *KeyHandler) HandleKey(r rune, isSingleByte bool, oldState *term.State) (bool, []string)

HandleKey processes UTF-8 rune input and returns true if should continue This method handles both single-byte (ASCII/control) and multibyte characters

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger provides functionality for the log command.

func NewLogger

func NewLogger(client git.Clienter) *Logger

NewLogger creates a new Logger.

func (*Logger) Log

func (l *Logger) Log(args []string)

Log executes the log command with the given arguments.

type Puller

type Puller struct {
	// contains filtered or unexported fields
}

Puller provides functionality for the pull command.

func NewPuller

func NewPuller(client git.Clienter) *Puller

NewPuller creates a new Puller.

func (*Puller) Pull

func (p *Puller) Pull(args []string)

Pull executes the pull command with the given arguments.

type Pusher

type Pusher struct {
	// contains filtered or unexported fields
}

Pusher provides functionality for the push command.

func NewPusher

func NewPusher(client git.Clienter) *Pusher

NewPusher creates a new Pusher.

func (*Pusher) Push

func (p *Pusher) Push(args []string)

Push executes the push command with the given arguments.

type Rebaser

type Rebaser struct {
	// contains filtered or unexported fields
}

Rebaser handles rebase operations.

func NewRebaser

func NewRebaser(client git.Clienter) *Rebaser

NewRebaser creates a new Rebaser instance.

func (*Rebaser) Rebase

func (r *Rebaser) Rebase(args []string)

Rebase executes git rebase commands.

func (*Rebaser) RebaseInteractive

func (r *Rebaser) RebaseInteractive()

RebaseInteractive executes interactive rebase.

type Remoter added in v5.0.3

type Remoter struct {
	// contains filtered or unexported fields
}

Remoter provides functionality for the remote command.

func NewRemoter added in v5.0.3

func NewRemoter(client git.Clienter) *Remoter

NewRemoter creates a new Remoter.

func (*Remoter) Remote added in v5.0.3

func (r *Remoter) Remote(args []string)

Remote executes the remote command with the given arguments.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer handles all terminal rendering operations

func (*Renderer) Render

func (r *Renderer) Render(ui *UI, state *UIState)

Render displays the command list with proper terminal handling

type Resetter

type Resetter struct {
	// contains filtered or unexported fields
}

Resetter handles reset operations.

func NewResetter

func NewResetter(client git.Clienter) *Resetter

NewResetter creates a new Resetter instance.

func (*Resetter) Reset

func (r *Resetter) Reset(args []string)

Reset executes git reset commands.

type Restorer added in v5.0.3

type Restorer struct {
	// contains filtered or unexported fields
}

Restorer handles restore operations.

func NewRestorer added in v5.0.3

func NewRestorer(client git.Clienter) *Restorer

NewRestorer creates a new Restorer instance.

func (*Restorer) Restore added in v5.0.3

func (r *Restorer) Restore(args []string)

Restore executes git restore commands.

type Stasher

type Stasher struct {
	// contains filtered or unexported fields
}

Stasher handles stash operations.

func NewStasher

func NewStasher(client git.Clienter) *Stasher

NewStasher creates a new Stasher instance.

func (*Stasher) Stash

func (s *Stasher) Stash(args []string)

Stash executes git stash commands.

type Statuser added in v5.0.3

type Statuser struct {
	// contains filtered or unexported fields
}

Statuser handles status operations.

func NewStatuser added in v5.0.3

func NewStatuser(client git.Clienter) *Statuser

NewStatuser creates a new Statuser instance.

func (*Statuser) Status added in v5.0.3

func (s *Statuser) Status(args []string)

Status executes git status with the given arguments.

type Tagger

type Tagger struct {
	// contains filtered or unexported fields
}

Tagger handles tagging operations.

func NewTagger

func NewTagger(client git.Clienter) *Tagger

NewTagger creates a new Tagger instance.

func (*Tagger) CreateAnnotatedTag

func (t *Tagger) CreateAnnotatedTag(args []string)

CreateAnnotatedTag creates an annotated tag

func (*Tagger) GetLatestTag

func (t *Tagger) GetLatestTag() (string, error)

GetLatestTag gets the latest tag.

func (*Tagger) GetTagCommit

func (t *Tagger) GetTagCommit(tagName string) (string, error)

GetTagCommit gets the commit hash for a tag.

func (*Tagger) Tag

func (t *Tagger) Tag(args []string)

Tag executes git tag operations with the given arguments.

func (*Tagger) TagExists

func (t *Tagger) TagExists(tagName string) bool

TagExists checks if a tag exists.

type UI

type UI struct {
	// contains filtered or unexported fields
}

UI represents the interface for terminal UI operations

func NewUI

func NewUI(gitClient git.Clienter) *UI

NewUI creates a new UI with the provided git client

func (*UI) Run

func (ui *UI) Run() []string

Run executes the interactive UI

type UIState

type UIState struct {
	// contains filtered or unexported fields
}

UIState holds the current state of the interactive UI

func (*UIState) AddRune added in v5.0.2

func (s *UIState) AddRune(r rune)

AddRune adds a UTF-8 rune to the input at cursor position

func (*UIState) ClearInput

func (s *UIState) ClearInput()

ClearInput clears all input

func (*UIState) DeleteToEnd

func (s *UIState) DeleteToEnd()

DeleteToEnd deletes from cursor to end of line (Ctrl+K)

func (*UIState) DeleteWord

func (s *UIState) DeleteWord()

DeleteWord deletes word before cursor (Ctrl+W)

func (*UIState) GetSelectedCommand

func (s *UIState) GetSelectedCommand() *CommandInfo

GetSelectedCommand returns the currently selected command

func (*UIState) HasInput

func (s *UIState) HasInput() bool

HasInput returns true if there is input

func (*UIState) HasMatches

func (s *UIState) HasMatches() bool

HasMatches returns true if there are filtered matches

func (*UIState) MoveDown

func (s *UIState) MoveDown()

MoveDown moves selection down

func (*UIState) MoveLeft added in v5.0.3

func (s *UIState) MoveLeft()

MoveLeft moves cursor one rune left

func (*UIState) MoveRight added in v5.0.3

func (s *UIState) MoveRight()

MoveRight moves cursor one rune right

func (*UIState) MoveToBeginning

func (s *UIState) MoveToBeginning()

MoveToBeginning moves cursor to beginning of line (Ctrl+A)

func (*UIState) MoveToEnd

func (s *UIState) MoveToEnd()

MoveToEnd moves cursor to end of line (Ctrl+E)

func (*UIState) MoveUp

func (s *UIState) MoveUp()

MoveUp moves selection up

func (*UIState) MoveWordLeft added in v5.0.3

func (s *UIState) MoveWordLeft()

MoveWordLeft moves cursor to the beginning of the previous word

func (*UIState) MoveWordRight added in v5.0.3

func (s *UIState) MoveWordRight()

MoveWordRight moves cursor to the start of the next word

func (*UIState) RemoveChar

func (s *UIState) RemoveChar()

RemoveChar removes character before cursor (backspace)

func (*UIState) UpdateFiltered

func (s *UIState) UpdateFiltered()

UpdateFiltered updates the filtered commands based on current input using fuzzy matching

type VersionGetter

type VersionGetter func() (version, commit string)

VersionGetter is a function type for getting version info

type Versioner added in v5.0.3

type Versioner struct {
	// contains filtered or unexported fields
}

Versioner handles version operations.

func NewVersioner added in v5.0.3

func NewVersioner(client git.Clienter) *Versioner

NewVersioner creates a new Versioner instance.

func (*Versioner) Version added in v5.0.3

func (v *Versioner) Version(args []string)

Version returns the ggc version with the given arguments.

Directories

Path Synopsis
Package templates provides templates for help messages.
Package templates provides templates for help messages.

Jump to

Keyboard shortcuts

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