Documentation
¶
Overview ¶
Package cli provides the command-line interface logic and orchestration for gitcommit.
Index ¶
- Constants
- func FormatSuccessMessage(gitFormattedDate string) string
- func HelpText() string
- type App
- type CommitRequest
- type Config
- type ErrorType
- type UserError
- func NewChronologyViolationError(providedDate, lastCommitDate string, equal bool) *UserError
- func NewGitCommandError(gitError string) *UserError
- func NewInvalidDateFormatError(provided string) *UserError
- func NewInvalidDateValueError(date string, reason string) *UserError
- func NewMissingArgumentsError(expected, received int) *UserError
- func NewNoRepositoryError() *UserError
Constants ¶
const ( // ExitSuccess indicates successful execution. ExitSuccess = 0 // ExitError indicates an error occurred. ExitError = 1 )
const (
// RequiredArguments is the number of arguments required for normal operation.
RequiredArguments = 2
)
Variables ¶
This section is empty.
Functions ¶
func FormatSuccessMessage ¶
FormatSuccessMessage formats a success message with a checkmark.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents the main application logic.
type CommitRequest ¶
type CommitRequest struct {
// InputDate is the raw date string provided by the user.
InputDate string
// CommitMessage is the commit message text.
CommitMessage string
// ParsedDate is the parsed and validated date with timezone.
ParsedDate time.Time
// GitFormattedDate is the date formatted for Git environment variables.
GitFormattedDate string
}
CommitRequest represents a user's request to create a commit with a specific date.
func NewCommitRequest ¶
func NewCommitRequest(date, message string) *CommitRequest
NewCommitRequest creates a new CommitRequest from user input.
type Config ¶
type Config struct {
// Version is the semantic version of the tool.
Version string
// ShowHelp indicates whether the --help flag was provided.
ShowHelp bool
// ShowVersion indicates whether the --version flag was provided.
ShowVersion bool
// Args contains positional arguments after flag parsing.
Args []string
}
Config holds the configuration for the CLI application.
func (*Config) GetMessage ¶
GetMessage returns the commit message argument.
type ErrorType ¶
type ErrorType int
ErrorType represents different categories of errors that can occur.
type UserError ¶
UserError represents an error with a user-friendly message.
func NewChronologyViolationError ¶
NewChronologyViolationError creates an error when date is before last commit.
func NewGitCommandError ¶
NewGitCommandError creates an error when a Git command fails.
func NewInvalidDateFormatError ¶
NewInvalidDateFormatError creates an error for invalid date format.
func NewInvalidDateValueError ¶
NewInvalidDateValueError creates an error for invalid calendar dates.
func NewMissingArgumentsError ¶
NewMissingArgumentsError creates an error when arguments are missing.
func NewNoRepositoryError ¶
func NewNoRepositoryError() *UserError
NewNoRepositoryError creates an error when not in a Git repository.