util

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: GPL-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package util provides libs for git-po-helper implementation.

Index

Constants

View Source
const (
	PoDir   = "po"
	GitPot  = "git.pot"
	CorePot = "git-core.pot"
)

Define const variables

View Source
const (
	EightSpaces = "        "
)

Variables

View Source
var (
	PotFileURL = "https://github.com/git-l10n/pot-changes/raw/pot/master/po/git.pot"
)

Functions

func AbbrevCommit

func AbbrevCommit(oid string) string

AbbrevCommit returns abbrev commit id

func AnswerIsTrue

func AnswerIsTrue(answer string) bool

AnswerIsTrue indicates answer is a true value

func CheckCamelCaseConfigVariableInPotFile added in v0.6.2

func CheckCamelCaseConfigVariableInPotFile() error

func CheckCorePoFile

func CheckCorePoFile(locale string) bool

CheckCorePoFile checks syntax of "po/xx.po" against "po/git-core.pot"

func CheckPoFile

func CheckPoFile(locale, poFile string) bool

CheckPoFile checks syntax of "po/xx.po".

func CheckPoFileWithPrompt added in v0.3.0

func CheckPoFileWithPrompt(locale, poFile string, prompt string) bool

CheckPoFileWithPrompt checks syntax of "po/xx.po", and use specific prompt.

func CheckPrereq

func CheckPrereq() error

CheckPrereq checks prerequisites for po-helper.

func CheckUnfinishedPoFiles added in v0.5.0

func CheckUnfinishedPoFiles(commit string, poFiles []string) bool

func CmdCheckCommits

func CmdCheckCommits(args ...string) bool

CmdCheckCommits implements check-commits sub command.

func CmdCheckPo

func CmdCheckPo(args ...string) bool

CmdCheckPo implements check-po sub command.

func CmdInit

func CmdInit(fileName string, onlyCore bool) bool

CmdInit implements init sub command.

func CmdUpdate

func CmdUpdate(fileName string) bool

CmdUpdate implements update sub command.

func DiffFileRevision

func DiffFileRevision(src, dest FileRevision) bool

DiffFileRevision implements diff on two files with specific revision.

func DiffFiles

func DiffFiles(src string, dest string) bool

DiffFiles implements diff on two files.

func Exist

func Exist(name string) bool

Exist check if path is exist.

func GetPrettyLocaleName

func GetPrettyLocaleName(locale string) (string, error)

GetPrettyLocaleName shows full language name and location

func GetUserInput

func GetUserInput(prompt, defaultValue string) string

GetUserInput reads user input from stdin

func IsDir

func IsDir(name string) bool

IsDir returns true if path is exist and is a directory.

func IsFile

func IsFile(name string) bool

IsFile returns true if path is exist and is a file.

func ReportInfoAndErrors added in v0.5.0

func ReportInfoAndErrors(errs []string, prompt string, ok bool)

func ReportWarnAndErrors added in v0.5.0

func ReportWarnAndErrors(errs []string, prompt string, ok bool)

func ShowExecError

func ShowExecError(err error)

ShowExecError will try to return error message of stderr

func ShowManpageConfigs added in v0.6.2

func ShowManpageConfigs(onlyCamelCase bool) error

func ShowTeams

func ShowTeams(args ...string) bool

ShowTeams will show leader/members of a team.

func UpdatePotFile added in v0.6.0

func UpdatePotFile() (string, bool)

UpdatePotFile creates or update pot file. If the returned pot filename is not empty, it's caller's duty to remove it.

Types

type CheckPoEntryFunc added in v0.6.2

type CheckPoEntryFunc func(string, string, string) ([]string, bool)

type FileRevision

type FileRevision struct {
	Revision string
	File     string
	Tmpfile  string
}

FileRevision is used as an argument for diff function

type Team

type Team struct {
	Language   string
	Repository string
	Leader     User
	Members    []User
}

Team contains infomation for a l10n team.

func ParseTeams

func ParseTeams(fileName string) ([]Team, []error)

ParseTeams implements parse of "po/TEAMS" file.

type User

type User struct {
	Name  string
	Email string
}

User contains user name and email.

Jump to

Keyboard shortcuts

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