util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTagNotFound = errors.New("tag not found")

Functions

func CGGenEvents

func CGGenEvents(outputDir, url, cgeVersion, language string) error

CGGenEvents downloads the correct cg-gen-events version for the specified CGE version and executes it.

func CheckVersion

func CheckVersion()

CheckVersion prints a warning, if there is a newer version of codegame-cli available.

func CompatibleVersion

func CompatibleVersion(versions map[string]string, version string) string

CompatibleVersion returns the next best compatible version in the versions map.

func Execute

func Execute(hidden bool, programName string, args ...string) (string, error)

Execute the program with args. If hidden is set, no output (except errors) will be printed and stdout will not be passed to the program. It returns the combined output if hidden is true. Otherwise all output will be printed directly to stdout.

func ExecuteModule

func ExecuteModule(name, libraryVersion, projectType string, args ...string) error

func GetCGEVersion

func GetCGEVersion(baseURL string) (string, error)

GetCGEVersion returns the CGE version of the game server in the format 'x.y'.

func GetEventNames

func GetEventNames(url, cgeVersion string) ([]string, error)

GetEventNames uses CGGenEvents() to get a list of all the available events of the game server at url. It only works for CGE versions >= 0.3

func GetUsername

func GetUsername() string

GetUsername tries to determine the name of the current user. It looks at the following things in order:

  1. git config user.name
  2. currently logged in user of the OS
  3. returns <your-name> with a note to change it

func GithubTagFromVersion

func GithubTagFromVersion(owner, repo, version string) (string, error)

func HasContentType

func HasContentType(h http.Header, mimetype string) bool

HasContentType returns true if the 'content-type' header includes mimetype.

func IsInstalled

func IsInstalled(programName string) bool

func LatestCGEVersion

func LatestCGEVersion() (string, error)

LatestCGEVersion returns the latest CGE version in the format 'x.y'.

func LatestGithubTag

func LatestGithubTag(owner, repo string) (string, error)

func LibraryVersionFromCGVersion

func LibraryVersionFromCGVersion(owner, repo, cgVersion string) string

func LoadVersionsJSON added in v0.5.1

func LoadVersionsJSON(owner, repo string) (io.ReadCloser, error)

func OpenBrowser

func OpenBrowser(url string) error

Opens the specified URL in the default browser.

func ParseVersion

func ParseVersion(version string) (int, int, int, error)

func UntargzFile

func UntargzFile(source io.Reader, fileName, outputFileName string) error

UntargzFile first decompresses source with gzip, then extracts the file with fileName into outputFileName.

func UnzipFile

func UnzipFile(source io.Reader, fileName, outputFileName string) error

UnzipFile first decompresses source with gzip, then extracts the file with fileName into outputFileName.

Types

This section is empty.

Jump to

Keyboard shortcuts

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