sys

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileModDateCompare

func FileModDateCompare(file1, file2 string) (diff int, err error)

FileModDateCompare compares the modification date of two files, and returns -1 if the first is older than the second, 0 if they are the same, and 1 if the 2nd is older than the first. Returns an error if either is not a file.

func FileRoot added in v0.0.9

func FileRoot(filename string) string

FileRoot returns the name of a file without any extensions.

func GetFlagString added in v0.14.0

func GetFlagString(key string) (string, bool)

GetFlagString returns the value of the given command line flag if it exists. This is sometimes needed to get to command line flags from init() functions. The value is a string, and can be in -key=value or -key value form.

func GetIpAddress added in v0.15.0

func GetIpAddress() string

GetIpAddress returns the string formatted ip address of the machine we are running on, as best can be determined.

func IsDir added in v0.0.9

func IsDir(path string) bool

IsDir returns true if the given path exists and is a directory

func LaunchChrome

func LaunchChrome(url string) (err error)

LaunchChromeHeadlessBrowser will launch google chrome with the given url.

func LaunchDefaultBrowser

func LaunchDefaultBrowser(url string) (err error)

LaunchDefaultBrowser launches the system's default browser and opens the browser to the given url. Not that most Linux systems do not have a default.

func PathExists

func PathExists(path string) bool

PathExists returns true if the given path exists in the OS. This does not necessarily mean that the path is usable. It may be write or read protected. But at least you know its there.

func SourceDirectory added in v0.0.9

func SourceDirectory() (dir string)

SourceDirectory is a utility function that returns the path to the directory of the file that called it.

func SourcePath added in v0.0.9

func SourcePath() (file string)

SourcePath is a utility function that returns the path to the file that called it.

Types

type WriterToFunc added in v0.19.0

type WriterToFunc func(w io.Writer) (int64, error)

func (WriterToFunc) WriteTo added in v0.19.0

func (f WriterToFunc) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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