pkg

package
v0.6.1-alpha Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGitmojiApiUrl = "https://gitmoji.dev/api/gitmojis"

DefaultGitmojiApiUrl The Url to reach the grimoji API

View Source
const DefaultGitmojiUrl = "https://gitmoji.dev/"

DefaultGitmojiUrl The URL to reach the gitmoji website

View Source
const EnvPrefix = "GO_GITMOJI_CLI"
View Source
const ProgramName = "go-gitmoji-cli"

Variables

View Source
var CommitSHA = ""

CommitSHA as provided by goreleaser.

View Source
var ConfigIsInit = false
View Source
var ErrInvalidGitHooksDirectoryPath = errors.New("invalid git hooks directory path")
View Source
var Version = ""

Version as provided by goreleaser.

Functions

func BuildCommitTitle

func BuildCommitTitle(_type string, scope string, isBreaking bool, desc string, gitmoji Gitmoji, config Config) string

func CacheGitmojis

func CacheGitmojis(gitmojis Gitmojis)

func CreateAllHookFiles

func CreateAllHookFiles() error

func ExecuteCommit

func ExecuteCommit(title string, body string, config Config)

func HookFilesExistent

func HookFilesExistent() ([]string, error)

func InitConfig

func InitConfig()

func LoadConfig

func LoadConfig(configPaths []string) (err error)

func RemoveAllHookFiles

func RemoveAllHookFiles() error

func ToggleDebug

func ToggleDebug(debug bool)

func UpdateConfig

func UpdateConfig(config Config, isGlobalConfig bool)

Types

type CommitFlagName

type CommitFlagName string
const (
	SCOPE       CommitFlagName = "Scope"
	DESC        CommitFlagName = "Desc"
	TYPE        CommitFlagName = "type"
	BODY        CommitFlagName = "body"
	IS_BREAKING CommitFlagName = "is-breaking"
)

type CommitMessageSource

type CommitMessageSource string
const (
	MESSAGE  CommitMessageSource = "message"
	TEMPLATE CommitMessageSource = "template"
	MERGE    CommitMessageSource = "merge"
	SQUASH   CommitMessageSource = "squash"
	COMMIT   CommitMessageSource = "commit"
)

type CommitType

type CommitType struct {
	Type string `mapstructure:"TYPE" json:"type"`
	Desc string `mapstructure:"DESC" json:"desc"`
}

func DefaultCommitTypes

func DefaultCommitTypes() []CommitType

func (CommitType) Description

func (i CommitType) Description() string

func (CommitType) FilterValue

func (i CommitType) FilterValue() string

func (CommitType) Title

func (i CommitType) Title() string

type CommitValues

type CommitValues struct {
	Title string
	Body  string
}

func CreateMessage

func CreateMessage(inputsRes []TextInputRes, selectedGitmoji Gitmoji, initialCommitValues InitialCommitValues, config Config, isBreaking bool) CommitValues

type Config

type Config struct {
	AutoAdd               bool               `mapstructure:"AUTO_ADD" json:"auto_add"`
	AutoSign              bool               `mapstructure:"AUTO_SIGN" json:"auto_sign"`
	AutoSignature         bool               `mapstructure:"AUTO_SIGNATURE" json:"auto_signature"`
	EmojiFormat           EmojiCommitFormats `mapstructure:"EMOJI_FORMAT" json:"emoji_format"`
	ScopePrompt           bool               `mapstructure:"SCOPE_PROMPT" json:"scope_prompt"`
	BodyPrompt            bool               `mapstructure:"BODY_PROMPT" json:"body_prompt"`
	CapitalizeTitle       bool               `mapstructure:"CAPITALIZE_TITLE" json:"capitalize_title"`
	GitmojisUrl           string             `mapstructure:"GITMOJIS_URL" json:"gitmojis_url"`
	UseDefaultGitMessages bool               `mapstructure:"USE_DEFAULT_GIT_MESSAGES" json:"use_default_git_messages"`
	Debug                 bool               `mapstructure:"DEBUG" json:"debug"`
}

func GetCurrentConfig

func GetCurrentConfig() (config Config, err error)

type ConfigEnum

type ConfigEnum string
const (
	AUTO_ADD                 ConfigEnum = "AUTO_ADD"
	AUTO_SIGN                ConfigEnum = "AUTO_SIGN"
	AUTO_SIGNATURE           ConfigEnum = "AUTO_SIGNATURE"
	EMOJI_FORMAT             ConfigEnum = "EMOJI_FORMAT"
	SCOPE_PROMPT             ConfigEnum = "SCOPE_PROMPT"
	GITMOJIS_URL             ConfigEnum = "GITMOJIS_URL"
	BODY_PROMPT              ConfigEnum = "BODY_PROMPT"
	CAPITALIZE_TITLE         ConfigEnum = "CAPITALIZE_TITLE"
	USE_DEFAULT_GIT_MESSAGES ConfigEnum = "USE_DEFAULT_GIT_MESSAGES"
	DEBUG                    ConfigEnum = "DEBUG"
)

type EmojiCommitFormats

type EmojiCommitFormats string
const (
	CODE  EmojiCommitFormats = "code"
	EMOJI EmojiCommitFormats = "emoji"
)

func (EmojiCommitFormats) Description

func (i EmojiCommitFormats) Description() string

func (EmojiCommitFormats) FilterValue

func (i EmojiCommitFormats) FilterValue() string

func (EmojiCommitFormats) Title

func (i EmojiCommitFormats) Title() string

type Gitmoji

type Gitmoji struct {
	Emoji  string `mapstructure:"emoji" json:"emoji"`
	Entity string `mapstructure:"entity" json:"entity"`
	Code   string `mapstructure:"code" json:"code"`
	Desc   string `mapstructure:"description" json:"description"`
	Name   string `mapstructure:"name" json:"name"`
	Semver string `mapstructure:"semver" json:"semver"`
}

func FindGitmoji

func FindGitmoji(emojiOrCode string, gitmojis []Gitmoji) *Gitmoji

func (Gitmoji) Description

func (i Gitmoji) Description() string

func (Gitmoji) FilterValue

func (i Gitmoji) FilterValue() string

func (Gitmoji) Title

func (i Gitmoji) Title() string

type Gitmojis

type Gitmojis struct {
	Gitmojis []Gitmoji `json:"gitmojis"`
}

func GetGitmojis

func GetGitmojis(config Config) (gitmojis Gitmojis)

func GetGitmojisCache

func GetGitmojisCache() (gitmojis Gitmojis, err error)

func UpdateGitmojis

func UpdateGitmojis(config Config) (gitmojis Gitmojis)

type InitialCommitValues

type InitialCommitValues struct {
	Type    string
	Scope   string
	Desc    string
	Body    string
	Gitmoji *Gitmoji
}

func BuildInitialCommitValues

func BuildInitialCommitValues(_type string, scope string, desc string, body string, commitMsg []string, gitmojis []Gitmoji) InitialCommitValues

func (InitialCommitValues) BuildTextInputsData

func (i InitialCommitValues) BuildTextInputsData(config Config) []TextInputData

type ParsedMessages

type ParsedMessages struct {
	Type       string
	Scope      string
	Desc       string
	IsBreaking bool
	Gitmoji    *Gitmoji
	Body       string
	Footer     string
}

func ParseCommitMessages

func ParseCommitMessages(messages []string, gitmojis []Gitmoji) (*ParsedMessages, error)

func ReadAndParseCommitEditMsg

func ReadAndParseCommitEditMsg(filePath string, gitmojis []Gitmoji) (*ParsedMessages, error)

type PlainFormatter

type PlainFormatter struct {
}

func (*PlainFormatter) Format

func (f *PlainFormatter) Format(entry *log.Entry) ([]byte, error)

type TextInputData

type TextInputData struct {
	Placeholder  string
	Charlimit    int
	InitialValue string
	Label        string
}

type TextInputRes

type TextInputRes struct {
	Value string
	Label string
}

type YesNo

type YesNo string
const (
	YES YesNo = "Yes"
	NO  YesNo = "NO"
)

func (YesNo) Description

func (i YesNo) Description() string

func (YesNo) FilterValue

func (i YesNo) FilterValue() string

func (YesNo) Title

func (i YesNo) Title() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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