pui

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MainLabel           = "Please select,ctrl+c to return,ctrl+d to exit"
	ApproveSummaryLabel = "Please check the approve summary"
	UserLoginLabel      = "Please select ssh user to login"
	NoPermission        = "No permission,Please apply for permission"
	SelectServer        = "Please select server for approve"
	SelectAction        = "Please select action"
	BybLabel            = "\n拜拜! 退出时间:%s\n"
	InfoLabel           = `` /* 793-byte string literal not displayed */

)

Functions

func FileExited

func FileExited(filename string) func(string) error

FileExited FileExited

func FileNotExited

func FileNotExited(filename string) func(string) error

FileNotExited FileNotExited

func GetServerSSHUsersMenu

func GetServerSSHUsersMenu(server Server, matchPolicies []Policy) func(int, MenuItem, *ssh.Session, []MenuItem) []MenuItem

判断权限在这里实现

func GetServersMenuV2

func GetServersMenuV2(sess *ssh.Session, user User) (map[string]MenuItem, error)

func IsDir

func IsDir() func(string) error

IsDir IsDir

func IsInt

func IsInt() func(string) error

IsInt check input

func IsNotDir

func IsNotDir() func(string) error

IsNotDir IsNotDir

func MultiValidate

func MultiValidate(validates [](func(string) error)) func(string) error

MultiValidate MultiValidate

func Required

func Required(field string) func(string) error

Required required validate

func YesOrNo

func YesOrNo() func(string) error

YesOrNo check yes/no

Types

type MenuItem struct {
	Label             string
	Info              map[string]string
	IsShow            func(index int, menuItem MenuItem, sess *ssh.Session, selectedChain []MenuItem) bool
	SubMenuTitle      string
	GetSubMenu        func(index int, menuItem MenuItem, sess *ssh.Session, selectedChain []MenuItem) []MenuItem
	SelectedFunc      func(index int, menuItem MenuItem, sess *ssh.Session, selectedChain []MenuItem) (bool, error)
	NoSubMenuInfo     string
	BackAfterSelected bool
	BackOptionLabel   string
}

MenuItem menu item

func GetApproveMenu

func GetApproveMenu(policies []*Policy) []MenuItem

type PUI

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

PUI pui

func NewPui

func NewPui(s *ssh.Session, timeout time.Duration) *PUI

func (*PUI) Exit

func (ui *PUI) Exit()

exit

func (*PUI) FlashTimeout

func (ui *PUI) FlashTimeout()

FlashTimeout flash timeout

func (*PUI) GetTimeout

func (ui *PUI) GetTimeout() string

getTimeout

func (*PUI) IsLogout

func (ui *PUI) IsLogout() bool

判断是否主动退出,依据是否超时

func (*PUI) IsTimeout

func (ui *PUI) IsTimeout() bool

判断是否超时

func (*PUI) SessionWrite

func (ui *PUI) SessionWrite(msg string) error

func (*PUI) ShowMainMenu

func (ui *PUI) ShowMainMenu()

ShowMainMenu show main menu

func (*PUI) ShowMenu

func (ui *PUI) ShowMenu(label string, menu []MenuItem, BackOptionLabel string, selectedChain []MenuItem)

ShowMenu show menu

Jump to

Keyboard shortcuts

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