function

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DockerConfig = `[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --data-root=` + varHome + `/Documents/Docker/Root -H fd://
`
View Source
var DockerConfigFile = "/etc/systemd/system/docker.service.d/override.conf"

docker配置文件内容

View Source
var GitConfig = `[user]
	name = ` + GetHostname() + `
	email = yj1516268@outlook.com
[core]
	editor = /usr/bin/nvim
	autocrlf = input
[merge]
	tool = vimdiff
[color]
	ui = true
[pull]
	rebase = false
[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
`
View Source
var GitConfigFile = varHome + "/.gitconfig"

git配置文件内容

View Source
var NpmConfig = `registry=https://registry.npm.taobao.org`
View Source
var NpmConfigFile = varHome + "/.npmrc"

npm配置文件内容

View Source
var PipConfig = `[global]
index-url = http://mirrors.aliyun.com/pypi/simple
trusted-host = mirrors.aliyun.com
`
View Source
var PipConfigFile = varHome + "/.config/pip/pip.conf"

pip配置文件内容

Functions

func CloneRepoViaHTTP added in v0.1.2

func CloneRepoViaHTTP(path string, url string, repo string)

通过HTTP协议克隆仓库

func CompareFile added in v0.1.0

func CompareFile(file1Path string, file2Path string) (bool, error)

并发比较两个文件是否相同

func CreateDir added in v0.1.0

func CreateDir(dirPath string) error

创建文件夹,如果其父目录不存在则创建父目录

func CreateFile added in v0.0.4

func CreateFile(filePath string) error

创建文件,如果其父目录不存在则创建父目录

func DeleteFile added in v0.0.4

func DeleteFile(filePath string) error

删除文件

func FileEmpty added in v0.0.5

func FileEmpty(filePath string) bool

判断文件是否为空

func FileExist added in v0.0.4

func FileExist(filePath string) bool

判断文件是否存在

func GetHostname added in v0.0.5

func GetHostname() string

获取不再环境变量中的HOSTNAME

func GetTomlConfig added in v0.0.4

func GetTomlConfig(filePath string) (*toml.Tree, error)

读取toml配置文件

func GetUserInfo added in v0.1.3

func GetUserInfo(uid int) (*user.User, error)

根据ID获取用户信息

func GetVariable added in v0.0.4

func GetVariable(key string) string

获取环境变量

func GoToDir added in v0.1.0

func GoToDir(dirPath string) error

进到指定目录

func InstallFile added in v0.1.0

func InstallFile(sourceFile, targetFile string) error

复制文件,如果文件存在则覆盖

func PolicyKitAuthentication added in v0.1.0

func PolicyKitAuthentication()

func ProgramInfo

func ProgramInfo() string

func RunCommandGetFlag added in v0.0.5

func RunCommandGetFlag(command string, args []string) bool

运行指定命令并获取标志位

func RunCommandGetResult added in v0.0.5

func RunCommandGetResult(command string, args []string) string

运行指定命令并获取命令输出

func SetVariable added in v0.1.0

func SetVariable(key, value string) error

设置环境变量

func WriteFile added in v0.0.5

func WriteFile(filePath string, content string) error

写入内容到文件

func WriteTomlConfig added in v0.0.4

func WriteTomlConfig(filePath string) (int64, error)

写入toml配置文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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