pkg

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EXECUTABLE_BASENAME string
View Source
var EXECUTABLE_PATH string

Functions

func AddExecutablePermission

func AddExecutablePermission(filePath string) error

func AskYN

func AskYN(prompt string) bool

ask yes or no

func ClearScreen

func ClearScreen()

func CommandExists

func CommandExists(cmd string) bool

func CreateHTTPClient

func CreateHTTPClient(timeoutsec time.Duration) *http.Client

func DownloadFile

func DownloadFile(filepath string, url string) (err error)

func DownloadFileWithProgress added in v0.0.12

func DownloadFileWithProgress(filepath string, url string) (err error)

func GetExecutableBasename

func GetExecutableBasename() (string, error)

func GetExecutablePath

func GetExecutablePath() (string, error)

func GetLinuxDistro

func GetLinuxDistro() string

func GetRandomUA added in v0.0.4

func GetRandomUA() string

func GetTermSize

func GetTermSize() (int, int, error)

func HasAnyFlag added in v0.0.12

func HasAnyFlag(flags ...string) bool

func IsPathExists

func IsPathExists(p string) bool

func IsPortInUseOnWindows added in v0.0.6

func IsPortInUseOnWindows(port int) bool

func IsPortOpen added in v0.0.6

func IsPortOpen(port int) bool

func LoadJson

func LoadJson(fpath string, v any) (err error)

func Output2PagerVer1

func Output2PagerVer1(pager *exec.Cmd, output string) (err error)

func Output2PagerVer2

func Output2PagerVer2(pager *exec.Cmd, output string) (err error)

func OutputResult

func OutputResult(out string, paging bool, pagerCmd string, doClear bool) error

pager or print config > $PAGER > less -f TODO 增加检测pager可用

func SaveJson

func SaveJson(fpath string, v any) (err error)

marshal struct and write to file

Types

type OSInfo added in v0.0.10

type OSInfo struct {
	OS            string
	Distro        string
	IsDebianBased bool
}

func GetOSInfo added in v0.0.10

func GetOSInfo() (*OSInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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