sys

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCopyToClipboard   = errors.New("copy to clipboard")
	ErrNotImplementedYet = errors.New("not implemented yet")
)

Functions

func BinExists

func BinExists(s string) bool

BinExists checks if the binary exists in $PATH.

func BinPath

func BinPath(s string) string

BinPath returns the path of the binary.

func CopyClipboard

func CopyClipboard(s string) error

CopyClipboard copies a string to the clipboard.

func Env

func Env(s, def string) string

Env retrieves an environment variable.

If the environment variable is not set, returns the default value.

func ErrAndExit added in v0.1.5

func ErrAndExit(err error)

ErrAndExit logs the error and exits the program.

func ExecuteCmd

func ExecuteCmd(arg ...string) error

ExecuteCmd runs a command with the given arguments and returns an error if the command fails.

func OSArgs

func OSArgs() []string

OSArgs returns the correct arguments for the OS.

func OpenInBrowser

func OpenInBrowser(s string) error

OpenInBrowser opens a URL in the default browser.

func ReadClipboard

func ReadClipboard() string

ReadClipboard reads the contents of the clipboard.

func RunCmd

func RunCmd(s string, arg ...string) error

RunCmd returns an *exec.Cmd with the given arguments.

Types

This section is empty.

Directories

Path Synopsis
Package files provides utilities for working with files/directories.
Package files provides utilities for working with files/directories.
Spinner displays a spinning cursor animation while waiting for a signal on a channel.
Spinner displays a spinning cursor animation while waiting for a signal on a channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳