common

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Yes = "yes"
	No  = "no"
)

Variables

View Source
var (
	Version   string
	BuildTime string

	LocaleBaseDir string
	LocaleDomain  string

	ConfigBaseDir string
	ConfigFile    string

	Organization string
	User         string
	Password     string
)

Initialized at build time

View Source
var (
	Language      string
	DefaultEditor string
	UserBaseDir   string
	Config        *conf.Configuration
	Exceptions    = make(map[string]bool)
)

Initialized at execution time

Functions

func EditFile

func EditFile(f string) error

Edit lets the user edit the given file.

func FileExists

func FileExists(path string) bool

FilExists check if the given file or directory exists on the system.

func GetOutputCommand

func GetOutputCommand(name string, args ...string) ([]byte, error)

GetOuptutCommand returns the redirected output of a system command.

func InstalledVersion

func InstalledVersion(app string) string

InstalledVersion returns the installed version of a package.

func JoinIfRelative

func JoinIfRelative(base, file string) string

JoinRelative returns the complete path of the file. - If the path of the file is absolute, it returns it. - If it is relative, it returns the absolute path from the base.

func LaunchCommand

func LaunchCommand(name string, args ...string) error

LaunchCommand launches a system command.

func Now

func Now() int64

Now returns the UNIX timestamp from the current time

func PrintError

func PrintError(e interface{})

PrintError print a red message in the stderr.

func PrintWarning

func PrintWarning(e interface{})

PrintWarning print a yellow message in the stderr.

func Question

func Question(msg string) string

Question displays a question to the output and returns the response given by the user.

func QuestionYN

func QuestionYN(msg string, defaultResponse bool) bool

QuestionYN displays a question to the output and returns the boolean response given by the user.

func StrToTimestamp

func StrToTimestamp(date string) int64

StrToTimeStamp converts a formatted string date to a timestamp.

func TimestampToString

func TimestampToString(unix int64) string

TimestampTostring convertis an UNIX timestamp to a formatted string.

func Tr

func Tr(msg string, vars ...interface{}) string

Tr returns the translated string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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