cli

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// chezmoi的依赖项
	ChezmoiDependencies = "/usr/bin/chezmoi"

	ChezmoiConfig     = fmt.Sprintf(chezmoiConfigFormat, chezmoiSourceDir, sep, chezmoiAutoCommit, sep, chezmoiAutoPush)
	ChezmoiConfigFile = filepath.Join(home, ".config", "chezmoi", "chezmoi.toml")

	// cobra的依赖项
	CobraDependencies = filepath.Join(goGOBIN, "cobra-cli")

	CobraConfig     = fmt.Sprintf(cobraConfigFormat, cobraAuthor, email, cobraLicense, cobraUseViper)
	CobraConfigFile = filepath.Join(home, ".cobra.yaml")

	// docker service和mirrors的依赖项
	DockerDependencies = "/usr/bin/dockerd"

	DockerServiceConfig     = fmt.Sprintf(dockerServiceConfigFormat, dockerServiceExecStart, dockerServiceDataRoot)
	DockerServiceConfigFile = "/etc/systemd/system/docker.service.d/override.conf"

	DockerMirrorsConfig     = fmt.Sprintf(dockerMirrorsConfigFormat, sep, dockerMirrorsRegistryMirrors)
	DockerMirrorsConfigFile = "/etc/docker/daemon.json"

	// frpc的依赖项
	FrpcDependencies = "/usr/bin/frpc"

	FrpcConfig     = fmt.Sprintf(frpcConfigFormat, frpcRestart)
	FrpcConfigFile = "/etc/systemd/system/frpc.service.d/override.conf"

	// git的依赖项
	GitDependencies = "/usr/bin/git"

	GitConfig     = fmt.Sprintf(gitConfigFormat, sep, hostname, sep, email, sep, gitCoreEditor, sep, gitCoreAutoCRLF, sep, gitMergeTool, sep, gitColorUI, sep, gitPullRebase, sep, gitFilterLfsClean, sep, gitFilterLfsSmudge, sep, gitFilterLfsProcess, sep, gitFilterLfsRequired)
	GitConfigFile = filepath.Join(home, ".gitconfig")

	// go的依赖项
	GoDependencies = "/usr/bin/go"

	GoConfig     = fmt.Sprintf(goConfigFormat, goGO111MODULE, goGOBIN, goGOPATH, goGOCACHE, goGOMODCACHE)
	GoConfigFile = filepath.Join(home, ".config", "go", "env")

	// npm的依赖项
	NpmDependencies = "/usr/bin/npm"

	NpmConfig     = fmt.Sprintf(npmConfigFormat, npmRegistry)
	NpmConfigFile = filepath.Join(home, ".npmrc")

	// pip的依赖项
	PipDependencies = "/usr/bin/pip"

	PipConfig     = fmt.Sprintf(pipConfigFormat, pipIndexUrl, pipTrustedHost)
	PipConfigFile = filepath.Join(home, ".config", "pip", "pip.conf")

	// system-checkupdates timer和service的依赖项
	SystemCheckupdatesDependencies = "/usr/local/bin/system-checkupdates" // >= 3.0.0-20230313.1

	SystemCheckupdatesTimerConfig     = fmt.Sprintf(systemCheckupdatesTimerConfigFormat, systemcheckupdatesTimerDescription, systemcheckupdatesTimerOnBootSec, systemcheckupdatesTimerOnUnitInactiveSec, systemcheckupdatesTimerAccuracySec, systemcheckupdatesTimerPersistent, systemcheckupdatesTimerWantedBy)
	SystemCheckupdatesTimerConfigFile = "/etc/systemd/system/system-checkupdates.timer"

	SystemCheckupdatesServiceConfig     = fmt.Sprintf(systemCheckupdatesServiceConfigFormat, systemcheckupdatesServiceDescription, systemcheckupdatesServiceAfter, systemcheckupdatesServiceWants, systemcheckupdatesServiceType, systemcheckupdatesServiceExecStart)
	SystemCheckupdatesServiceConfigFile = "/etc/systemd/system/system-checkupdates.service"
)

Functions

func CloneRepoViaHTTP

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

CloneRepoViaHTTP 通过 HTTP 协议克隆仓库

func DownloadFile

func DownloadFile(url string, outputFile string) (string, error)

DownloadFile 通过 HTTP 协议下载文件

func GetTomlConfig

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

GetTomlConfig 读取 toml 配置文件

func InstallFile

func InstallFile(sourceFile, targetFile string) error

InstallFile 安装文件,如果文件存在则覆盖

func WriteTomlConfig

func WriteTomlConfig(filePath string) (int64, error)

WriteTomlConfig 写入 toml 配置文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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