cli

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTomlConfig

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

GetTomlConfig 读取 toml 配置文件

参数:

  • filePath: toml 配置文件路径

返回:

  • toml 配置树
  • 错误信息

func RollingCloneRepos

func RollingCloneRepos(configTree *toml.Tree, source string)

RollingCloneRepos 遍历克隆远端仓库到本地

参数:

  • configTree: 解析 toml 配置文件得到的配置树
  • source: 远端仓库源,支持 'github' 和 'gitea',默认为 'github'

func RollingPullRepos added in v0.11.0

func RollingPullRepos(confile, source string)

RollingPullRepos 遍历拉取远端仓库的更改到本地

参数:

  • confile: 程序配置文件
  • source: 远端仓库源,支持 'github' 和 'gitea',默认为 'github'

func WriteTomlConfig

func WriteTomlConfig(filePath string) (int64, error)

WriteTomlConfig 写入 toml 配置文件

参数:

  • filePath: toml 配置文件路径

返回:

  • 写入的字节数
  • 错误信息

Types

type Config added in v0.12.7

type Config struct {
	Git     GitConfig     `toml:"git"`
	Script  ScriptConfig  `toml:"script"`
	SSH     SSHConfig     `toml:"ssh"`
	Storage StorageConfig `toml:"storage"`
}

用于转换 Toml 配置树的结构体

func LoadConfigToStruct added in v0.12.7

func LoadConfigToStruct(configTree *toml.Tree) (*Config, error)

LoadConfigToStruct 将 Toml 配置树加载到结构体

参数:

  • configTree: 解析 toml 配置文件得到的配置树

返回:

  • 结构体
  • 错误信息

type GitConfig added in v0.12.7

type GitConfig struct {
	GithubUrl      string   `toml:"github_url"`
	GithubUsername string   `toml:"github_username"`
	GiteaUrl       string   `toml:"gitea_url"`
	GiteaUsername  string   `toml:"gitea_username"`
	Repos          []string `toml:"repos"`
}

type SSHConfig added in v0.12.7

type SSHConfig struct {
	RsaFile string `toml:"rsa_file"`
}

type ScriptConfig added in v0.12.7

type ScriptConfig struct {
	NameList []string `toml:"name_list"`
}

type StorageConfig added in v0.12.7

type StorageConfig struct {
	Path string `toml:"path"`
}

Jump to

Keyboard shortcuts

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