pkg

package
v0.1.0-pre-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 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"
View Source
const Version = "v0.1.0"

Variables

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

Functions

func AddEnvPrefix

func AddEnvPrefix(suffix string) string

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 ProgramNameFigure

func ProgramNameFigure()

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 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"`
	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"`
}
var ConfigInstance Config

func LoadConfig

func LoadConfig(configPaths []string) (config Config, err error)

type ConfigEnum

type ConfigEnum string
const (
	AUTO_ADD         ConfigEnum = "AUTO_ADD"
	AUTO_SIGN        ConfigEnum = "AUTO_SIGN"
	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"
)

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 (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() (gitmojis Gitmojis)

func GetGitmojisCache

func GetGitmojisCache() (gitmojis Gitmojis, err error)

type InitialCommitValues

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

func (InitialCommitValues) BuildTextInputsData

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

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