pkg

package
v0.0.0-...-5710d78 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Commands []prompt.Suggest
)

TODO: 解析alias

View Source
var (
	Config *viper.Viper
)
View Source
var LivePrefixState struct {
	LivePrefix string
	IsEnable   bool
}

实时左标显示

Functions

func ChangeYourCmdEnvironment

func ChangeYourCmdEnvironment(cmd *exec.Cmd) error

func Chdir

func Chdir(in string) error

Chdir 将程序工作路径修改成程序所在位置

func Exec

func Exec()

func ExecCommandString

func ExecCommandString(cmd string) (string, error)

func FilterInnerCmd

func FilterInnerCmd(args []string) []prompt.Suggest

TODO: 内置命令解析

func FirstCommandFunc

func FirstCommandFunc(in prompt.Document, args []string) []prompt.Suggest

用户自定义命令

func GetCommon

func GetCommon(cmd, target string) string

获取说明

func GetCurrPath

func GetCurrPath(in string) string

func Home

func Home() (string, error)

Home returns the home directory for the executing user.

This uses an OS-specific method for discovering the home directory. An error is returned if a home directory cannot be detected.

func IsDir

func IsDir(path string) bool

判断所给路径是否为文件夹

func IsFile

func IsFile(path string) bool

判断所给路径是否为文件

func IsPathExists

func IsPathExists(path string) bool

func OptionsCompleters

func OptionsCompleters(args []string) []prompt.Suggest

long == --

func ParseCd

func ParseCd(path, cmd string) []prompt.Suggest

解析内置命令 TODO: 哪里不能进行搜索了

func ParseExecutors

func ParseExecutors(in string) (func(), bool)

* 解析执行命令函数 @param in // command from @result func() // function @result bool // 状态 是否执行

func ParseLs

func ParseLs(path string) []prompt.Suggest

func Test

func Test()

Types

type Cli

type Cli struct {
	IP       string //IP地址
	Username string //用户名
	Password string //密码
	Port     int    //端口号

	LastResult string //最近一次Run的结果
	// contains filtered or unexported fields
}

func Ssh

func Ssh(ip string, username string, password string, port ...int) *Cli

创建命令行对象 @param ip IP地址 @param username 用户名 @param password 密码 @param port 端口号,默认22

func (Cli) Run

func (c Cli) Run(shell string) (string, error)

执行shell @param shell shell脚本命令

Jump to

Keyboard shortcuts

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