pkg

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCommand

func CheckCommand(prefix, value string) (has bool, err error)

func ExecuteCommand

func ExecuteCommand(prefix, bin string, value []string, pipe bool) (err error)

func ExistApplications

func ExistApplications(prefix, value string) (has bool, err error)

func ExistPath

func ExistPath(prefix, base, value string) (has bool, err error)

*

  • 检查目录是否存在

func FilterAppendEnv

func FilterAppendEnv(prefix string, envs []*Env) (export []string)

*

  • 检查 env, 并生成待追加的环境变量

func GetCurrentProfile

func GetCurrentProfile(prefix string) (profile string, err error)

func GetHomeDir

func GetHomeDir(prefix string) (homeDir string, e error)

func InstallByBrew

func InstallByBrew(prefix, cmd string) (err error)

func LogFormatted

func LogFormatted(format string, parameters ...interface{}) (err error)

*

  • format 不需要 增加 [%s]
  • parameters 格式化中的对应的占位
  • 第一个参数 prefix 前缀

func SettingEnv

func SettingEnv(prefix string, value []string, target string) (result bool, err error)

*

  • prefix: 日志的前缀, 建议 Package.Name
  • value: export key=value;
  • target: 将export配置文件写入到目标文件

Types

type Application

type Application interface {
	/**
	 * 应用的关键字
	 */
	Key() string

	/**
	 * 获取安装
	 */
	GetPackage() *Package

	/**
	 * 安装前事件
	 * false: 不会执行后续事件
	 */
	Before(value *Package, overwrite bool) bool

	/**
	 * 安装应用
	 */
	Install(value *Package) bool

	/**
	 * 升级应用
	 */
	Upgrade(value *Package) bool

	/**
	 * 安装后事件
	 */
	After(value *Package)
}

*

  • 定义应用

type Brew

type Brew struct {
	Log
}

func NewBrew

func NewBrew() *Brew

func (*Brew) After

func (v *Brew) After(value *Package)

func (*Brew) Before

func (v *Brew) Before(value *Package, overwrite bool) bool

func (*Brew) GetPackage

func (v *Brew) GetPackage() *Package

func (*Brew) Install

func (v *Brew) Install(value *Package) bool

*

  • 安装应用

func (*Brew) Key

func (v *Brew) Key() string

func (*Brew) Upgrade

func (v *Brew) Upgrade(value *Package) bool

*

  • 升级应用

type Env

type Env struct {
	Key       string `json:"key,omitempty" yaml:"key,omitempty"`               // 环境变量名字
	Value     string `json:"value,omitempty" yaml:"value,omitempty"`           // 环境变量值
	AppendKey string `json:"append_key,omitempty" yaml:"append_key,omitempty"` // 追加到指定变量
}

type GitflowControl

type GitflowControl struct {
	Log
}

func NewGitflowControl

func NewGitflowControl() *GitflowControl

func (*GitflowControl) After

func (v *GitflowControl) After(value *Package)

func (*GitflowControl) Before

func (v *GitflowControl) Before(value *Package, overwrite bool) bool

func (*GitflowControl) GetPackage

func (v *GitflowControl) GetPackage() *Package

func (*GitflowControl) Install

func (v *GitflowControl) Install(value *Package) bool

func (*GitflowControl) Key

func (v *GitflowControl) Key() string

func (*GitflowControl) Upgrade

func (v *GitflowControl) Upgrade(value *Package) bool

type Golang

type Golang struct{ Log }

func NewGolang

func NewGolang() *Golang

func (*Golang) After

func (v *Golang) After(value *Package)

*

  • 后置事件

func (*Golang) Before

func (v *Golang) Before(value *Package, overwrite bool) bool

*

  • 前置事件

func (*Golang) GetPackage

func (v *Golang) GetPackage() *Package

func (*Golang) Install

func (v *Golang) Install(value *Package) bool

*

  • 安装应用

func (*Golang) Key

func (v *Golang) Key() string

func (*Golang) Upgrade

func (v *Golang) Upgrade(value *Package) bool

*

  • 升级应用

type ITerm2

type ITerm2 struct {
	Log
}

func NewITerm2

func NewITerm2() *ITerm2

func (*ITerm2) After

func (v *ITerm2) After(value *Package)

func (*ITerm2) Before

func (v *ITerm2) Before(value *Package, overwrite bool) bool

func (*ITerm2) GetPackage

func (v *ITerm2) GetPackage() *Package

func (*ITerm2) Install

func (v *ITerm2) Install(value *Package) bool

func (*ITerm2) Key

func (v *ITerm2) Key() string

func (*ITerm2) Upgrade

func (v *ITerm2) Upgrade(value *Package) bool

type Log

type Log struct {
	Key string
}

func (*Log) Println

func (v *Log) Println(format string, args ...interface{})

type Ohmyzsh

type Ohmyzsh struct {
	Log
}

func NewOhmyzsh

func NewOhmyzsh() *Ohmyzsh

func (*Ohmyzsh) After

func (v *Ohmyzsh) After(value *Package)

*

  • 之后事件

func (*Ohmyzsh) Before

func (v *Ohmyzsh) Before(value *Package, overwrite bool) bool

func (*Ohmyzsh) GetPackage

func (v *Ohmyzsh) GetPackage() *Package

func (*Ohmyzsh) Install

func (v *Ohmyzsh) Install(value *Package) bool

*

  • 安装应用

func (*Ohmyzsh) Key

func (v *Ohmyzsh) Key() string

func (*Ohmyzsh) Upgrade

func (v *Ohmyzsh) Upgrade(value *Package) bool

*

  • 升级应用

type OhmyzshPlugin

type OhmyzshPlugin struct {
	Plugin []*Plugin
	Log
}

func NewOhmyzshPlugin

func NewOhmyzshPlugin() *OhmyzshPlugin

func (*OhmyzshPlugin) After

func (v *OhmyzshPlugin) After(value *Package)

*

  • 之后事件

func (*OhmyzshPlugin) Before

func (v *OhmyzshPlugin) Before(value *Package, overwrite bool) bool

func (*OhmyzshPlugin) GetPackage

func (v *OhmyzshPlugin) GetPackage() *Package

func (*OhmyzshPlugin) GetPlugin

func (o *OhmyzshPlugin) GetPlugin() (key []string)

*

  • 获取插件 name []string

func (*OhmyzshPlugin) Install

func (v *OhmyzshPlugin) Install(value *Package) bool

*

  • 安装应用

func (*OhmyzshPlugin) Key

func (v *OhmyzshPlugin) Key() string

func (*OhmyzshPlugin) Upgrade

func (v *OhmyzshPlugin) Upgrade(value *Package) bool

*

  • 升级应用

type Package

type Package struct {
	Name        string   `json:"name,omitempty" yaml:"name,omitempty"`               // 包名字
	Bin         string   `json:"bin,omitempty" yaml:"bin,omitempty"`                 // 安装后的名字
	Version     string   `json:"version,omitempty" yaml:"version,omitempty"`         // 安装包版本
	Env         []*Env   `json:"env,omitempty" yaml:"env,omitempty"`                 // 环境变量
	Shell       string   `json:"shell,omitempty" yaml:"shell,omitempty"`             // 安装脚本
	Compress    string   `json:"compress,omitempty" yaml:"compress,omitempty"`       // zip, tar.gz, tar, tar.bz2, rar, xz, tar.xz, git, dmg, txt
	Target      string   `json:"target,omitempty" yaml:"target,omitempty"`           // target 默认为 /Applications
	Description string   `json:"description,omitempty" yaml:"description,omitempty"` // 描述信息
	Source      []string `json:"source,omitempty" yaml:"source,omitempty"`           // 源文件 文件下载地址 | git clone 地址 | 备用 git clone地址
}

type Plugin

type Plugin struct {
	Name   string   // 名字
	Source string   // 源码
	Target string   // 目标
	Shell  []string // 自定义 shell
}

type Rust

type Rust struct {
	Log
}

func NewRust

func NewRust() *Rust

func (*Rust) After

func (v *Rust) After(value *Package)

func (*Rust) Before

func (v *Rust) Before(value *Package, overwrite bool) bool

func (*Rust) GetPackage

func (v *Rust) GetPackage() *Package

func (*Rust) Install

func (v *Rust) Install(value *Package) bool

func (*Rust) Key

func (v *Rust) Key() string

func (*Rust) Upgrade

func (v *Rust) Upgrade(value *Package) bool

type Software

type Software struct {
}

func (*Software) After

func (v *Software) After(value *Package)

func (*Software) Before

func (v *Software) Before(value *Package, overwrite bool) bool

func (*Software) GetPackage

func (v *Software) GetPackage() *Package

func (*Software) Install

func (v *Software) Install(value *Package) bool

func (*Software) Key

func (v *Software) Key() string

func (*Software) Upgrade

func (v *Software) Upgrade(value *Package) bool

type Template

type Template struct {
	Log
}

func NewTemplate

func NewTemplate() *Template

func (*Template) After

func (v *Template) After(value *Package)

func (*Template) Before

func (v *Template) Before(value *Package, overwrite bool) bool

func (*Template) GetPackage

func (v *Template) GetPackage() *Package

func (*Template) Install

func (v *Template) Install(value *Package) bool

func (*Template) Key

func (v *Template) Key() string

func (*Template) Upgrade

func (v *Template) Upgrade(value *Package) bool

type Vim

type Vim struct {
	Log
}

func NewVim

func NewVim() *Vim

func (*Vim) After

func (v *Vim) After(value *Package)

*

  • 后置事件

func (*Vim) Before

func (v *Vim) Before(value *Package, overwrite bool) bool

*

  • 前置事件

func (*Vim) GetPackage

func (v *Vim) GetPackage() *Package

func (*Vim) Install

func (v *Vim) Install(value *Package) bool

*

  • 安装应用

func (*Vim) Key

func (v *Vim) Key() string

func (*Vim) Upgrade

func (v *Vim) Upgrade(value *Package) bool

*

  • 升级应用

Jump to

Keyboard shortcuts

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