Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAndPrintUsageGuide()
- func CheckAndPrintVersion()
- func ClearScreen()
- func Completer(doc prompt.Document) []prompt.Suggest
- func Connect(s *Server) error
- func DoEnter(*prompt.Buffer)
- func DoFirstPage(*prompt.Buffer)
- func DoLastPage(*prompt.Buffer)
- func DoMakeLivePrefix() (string, bool)
- func DoNextPage(*prompt.Buffer)
- func DoPrevPage(*prompt.Buffer)
- func Echo(format string, args ...interface{})
- func EchoAndExit(format string, args ...interface{})
- func Error(format string, args ...interface{})
- func ErrorAndExit(format string, args ...interface{})
- func Executor(input string)
- func Exit(n int)
- func NewConsoleParserWrapper() prompt.ConsoleParser
- func Options() []prompt.Option
- func Reset()
- func ShowTitle()
- func ShowUsageGuide()
- type Config
- type ConsoleParserWrapper
- type Server
Constants ¶
View Source
const Version = "v0.0.3"
Variables ¶
View Source
var Cfg = NewConfig()
View Source
var CommandSuggests = []prompt.Suggest{
{Text: "-n", Description: "Displays the next page of the server list."},
{Text: "-p", Description: "Displays the previous page of the server list."},
{Text: "-g", Description: "Set the group for the server list."},
{Text: "-h", Description: "Display the usage guide of J2."},
{Text: "-exit", Description: "Exit J2."},
}
View Source
var DefaultConsoleParserWrapper = NewConsoleParserWrapper()
View Source
var KeyHandlers = map[prompt.Key]prompt.KeyBindFunc{ prompt.Enter: DoEnter, prompt.ControlM: DoEnter, prompt.ControlJ: DoEnter, prompt.PageUp: DoPrevPage, prompt.PageDown: DoNextPage, prompt.Home: DoFirstPage, prompt.End: DoLastPage, }
View Source
var State *terminal.State
Functions ¶
func CheckAndPrintUsageGuide ¶ added in v0.0.3
func CheckAndPrintUsageGuide()
func CheckAndPrintVersion ¶
func CheckAndPrintVersion()
func ClearScreen ¶
func ClearScreen()
func DoFirstPage ¶ added in v0.0.2
func DoFirstPage(*prompt.Buffer)
func DoLastPage ¶ added in v0.0.2
func DoLastPage(*prompt.Buffer)
func DoMakeLivePrefix ¶
func DoNextPage ¶ added in v0.0.2
func DoNextPage(*prompt.Buffer)
func DoPrevPage ¶ added in v0.0.2
func DoPrevPage(*prompt.Buffer)
func EchoAndExit ¶
func EchoAndExit(format string, args ...interface{})
func ErrorAndExit ¶
func ErrorAndExit(format string, args ...interface{})
func NewConsoleParserWrapper ¶ added in v0.0.3
func NewConsoleParserWrapper() prompt.ConsoleParser
func ShowUsageGuide ¶
func ShowUsageGuide()
Types ¶
type Config ¶
type Config struct { PageSize int `yaml:"pageSize"` // 每页显示多少个服务器(默认10) SortBy string `yaml:"sortBy"` // 排序方式(name, host, disable) AutoClear bool `yaml:"autoClear"` // 自动清屏 PrivateKey string `yaml:"privateKey"` // 全局的私钥路径(可被服务器设置覆盖) Password string `yaml:"password"` // 全局的登录密码(可被服务器设置覆盖) Servers []*Server `yaml:"servers"` // 远程服务器列表 Auth ssh.AuthMethod `yaml:"-"` Page int `yaml:"-"` Group string `yaml:"-"` }
func (*Config) ShowSummary ¶
func (c *Config) ShowSummary()
type ConsoleParserWrapper ¶ added in v0.0.3
type ConsoleParserWrapper struct { prompt.ConsoleParser // contains filtered or unexported fields }
func (*ConsoleParserWrapper) Setup ¶ added in v0.0.3
func (w *ConsoleParserWrapper) Setup() error
func (*ConsoleParserWrapper) TearDown ¶ added in v0.0.3
func (w *ConsoleParserWrapper) TearDown() error
type Server ¶
type Server struct { Name string `yaml:"name"` // 名称(可被用于搜索和快速连接) User string `yaml:"user"` // 登录用户名 Host string `yaml:"host"` // 登录主机名或IP地址 Port int `yaml:"port"` // 登录端口(默认22) PrivateKey string `yaml:"privateKey"` // 私钥路径(为空时不适用) Password string `yaml:"password"` // 登录密码(私钥登录优先,没有私钥则使用密码) Desc string `yaml:"desc"` // 简短的描述 Group string `yaml:"group"` // 分组 Auth ssh.AuthMethod `yaml:"-"` Addr string `yaml:"-"` }
Click to show internal directories.
Click to hide internal directories.