internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFileMd5 added in v0.2.0

func GetFileMd5(file string) (string, error)

func GetFilePerm

func GetFilePerm(fm fs.FileMode) string

func GetRemoteRevPath added in v0.2.0

func GetRemoteRevPath(localRootPath, remoteRootPath, localPath string, keepRemoteBaseDir bool) string

如果是 receive,则 keepRemoteBaseDir 需要传 true,来保留远程目录的最后一个子目录

func PrintfGreen

func PrintfGreen(msg string, args ...interface{})

func PrintfWhite

func PrintfWhite(msg string, args ...interface{})

func PrintfYellow

func PrintfYellow(msg string, args ...interface{})

func SplitShellCommand added in v0.2.0

func SplitShellCommand(cmd string) []string

func Walk

func Walk(dir, dir2 string, f func(isDir bool, path, target string) error) error

注意:walk 函数不要直接用 f 函数处理 dir 自己,否则会死循环

Types

type Command

type Command interface {
	Md5File(file string) (string, error)
}

type LocalCommand

type LocalCommand struct{}

func NewLocalCommand

func NewLocalCommand() *LocalCommand

func (*LocalCommand) Md5File

func (r *LocalCommand) Md5File(file string) (string, error)

func (*LocalCommand) RunCommand added in v0.2.0

func (r *LocalCommand) RunCommand(cmd string) (string, error)

func (*LocalCommand) RunCommandInPipe added in v0.2.0

func (r *LocalCommand) RunCommandInPipe(cmd string) (string, error)

type SSH

type SSH struct {
	// contains filtered or unexported fields
}

func NewSSH

func NewSSH(config *SSHConfig) *SSH

func (*SSH) Client added in v0.2.0

func (r *SSH) Client() *ssh.Client

func (*SSH) Close

func (r *SSH) Close() error

func (*SSH) Dial

func (r *SSH) Dial() error

func (*SSH) Download added in v0.2.0

func (r *SSH) Download(src, dest string) error

func (*SSH) PrintMeta

func (r *SSH) PrintMeta()

func (*SSH) Run

func (r *SSH) Run(cmd string, args ...interface{}) (string, error)

func (*SSH) RunInPipe added in v0.2.0

func (r *SSH) RunInPipe(cmd string, args ...interface{}) (string, error)

func (*SSH) Upload added in v0.2.0

func (r *SSH) Upload(src, dest string) error

type SSHConfig

type SSHConfig struct {
	Host          string
	User          string
	SSHPrivateKey []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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