cmdrunner

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: Apache-2.0 Imports: 50 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

View Source
const (
	HistoryTypeScreen  = "screen"
	HistoryTypeSession = "session"
	HistoryTypeGlobal  = "global"
)
View Source
const (
	KwArgRenderer = "renderer"
	KwArgView     = "view"
	KwArgState    = "state"
	KwArgTemplate = "template"
	KwArgLang     = "lang"
	KwArgMinimap  = "minimap"
	KwArgNoHist   = "nohist"
	KwArgSudo     = "sudo"
)
View Source
const (
	R_Session         = 1
	R_Screen          = 2
	R_Remote          = 8
	R_RemoteConnected = 16
)
View Source
const (
	ConnectedRemote = "connected"
	LocalRemote     = "local"
)
View Source
const (
	CmdParseTypePositional = "pos"
	CmdParseTypeRaw        = "raw"
)
View Source
const DefaultMaxHistoryItems = 10000
View Source
const DefaultPTERM = "MxM"
View Source
const DefaultUserId = "user"
View Source
const HistoryViewPageSize = 50
View Source
const MaxCommandLen = 4096
View Source
const MaxEvalDepth = 5
View Source
const MaxFontFamilyLen = 50
View Source
const MaxNameLen = 50
View Source
const MaxOpenAIAPITokenLen = 100
View Source
const MaxOpenAIModelLen = 100
View Source
const MaxRemoteAliasLen = 50
View Source
const MaxRendererLen = 50
View Source
const MaxShareNameLen = 150
View Source
const MaxSidebarSections = 5
View Source
const MaxSignalLen = 12
View Source
const MaxSignalNum = 64
View Source
const OpenAICloudCompletionTelemetryOffErrorMsg = "" /* 722-byte string literal not displayed */
View Source
const OpenAIPacketTimeout = 10 * 1000 * time.Millisecond
View Source
const OpenAIStreamTimeout = 5 * time.Minute
View Source
const PTermMax = "M"
View Source
const PasswordUnchangedSentinel = "--unchanged--"
View Source
const TermFontSizeMax = 24
View Source
const TermFontSizeMin = 8
View Source
const TsFormatStr = "2006-01-02 15:04:05"

Variables

View Source
var BareMetaCmds = []BareMetaCmdDecl{
	{"cr", "cr"},
	{"connect", "cr"},
	{"clear", "clear"},
	{"reset", "reset"},
	{"codeedit", "codeedit"},
	{"codeview", "codeview"},
	{"imageview", "imageview"},
	{"markdownview", "markdownview"},
	{"mdview", "markdownview"},
	{"csvview", "csvview"},
	{"pdfview", "pdfview"},
	{"mediaview", "mediaview"},
}
View Source
var CmdParseOverrides map[string]string = map[string]string{
	"setenv":  CmdParseTypePositional,
	"unset":   CmdParseTypePositional,
	"set":     CmdParseTypePositional,
	"run":     CmdParseTypeRaw,
	"comment": CmdParseTypeRaw,
	"chat":    CmdParseTypeRaw,
}
View Source
var ColorNames = []string{"yellow", "blue", "pink", "mint", "cyan", "violet", "orange", "green", "red", "white"}
View Source
var ConfirmFlags = []string{"hideshellprompt"}
View Source
var GlobalCmds = []string{"session", "screen", "remote", "set", "client", "telemetry", "bookmark", "bookmarks"}
View Source
var MetaCmdFnMap = make(map[string]MetaCmdEntryType)
View Source
var NoHistCmds = []string{"_compgen", "line", "history", "_killserver"}
View Source
var RemoteColorNames = []string{"red", "green", "yellow", "blue", "magenta", "cyan", "white", "orange"}
View Source
var RemoteSetArgs = []string{"alias", "connectmode", "key", "password", "autoinstall", "color"}
View Source
var ScreenCmds = []string{"run", "comment", "cd", "cr", "clear", "sw", "reset", "signal", "chat"}
View Source
var SetVarNameMap map[string]string = map[string]string{
	"tabcolor": "screen.tabcolor",
	"tabicon":  "screen.tabicon",
	"pterm":    "screen.pterm",
	"anchor":   "screen.anchor",
	"focus":    "screen.focus",
	"line":     "screen.line",
	"index":    "screen.index",
}
View Source
var SetVarScopes = []SetVarScope{
	{ScopeName: "global", VarNames: []string{}},
	{ScopeName: "client", VarNames: []string{"telemetry"}},
	{ScopeName: "session", VarNames: []string{"name", "pos", "theme"}},
	{ScopeName: "screen", VarNames: []string{"name", "tabcolor", "tabicon", "pos", "pterm", "anchor", "focus", "line", "index", "theme"}},
	{ScopeName: "line", VarNames: []string{}},

	{ScopeName: "connection", VarNames: []string{"alias", "connectmode", "key", "password", "autoinstall", "color"}},
	{ScopeName: "remote", VarNames: []string{}},
}
View Source
var SidebarNames = []string{"main"}
View Source
var TabIcons = []string{"square", "sparkle", "fire", "ghost", "cloud", "compass", "crown", "droplet", "graduation-cap", "heart", "file"}
View Source
var ThemeSources = []string{"light", "dark", "system"}
View Source
var ValidMetaCmdRe = regexp.MustCompile("^/([a-z_][a-z0-9_-]*)(?::([a-z][a-z0-9_-]*))?$")

Functions

func BuildOpenAIPromptArrayWithContext

func BuildOpenAIPromptArrayWithContext(messages []*packet.OpenAICmdInfoChatMessage) []packet.OpenAIPromptMessageType

func CheckOptionAlias

func CheckOptionAlias(kwargs map[string]string, aliases ...string) (string, bool)

func ClearSudoCache

func ClearSudoCache(ctx context.Context, pk *scpacket.FeCommandPacketType) (rtnUpdate scbus.UpdatePacket, rtnErr error)

func ClientConfirmFlagCommand

func ClientConfirmFlagCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error)

confirm flags must be all lowercase and only contain letters, numbers, and underscores (and start with letter)

func ClientNotifyUpdateWriterCommand

func ClientNotifyUpdateWriterCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error)

func ClientSetRightSidebarCommand

func ClientSetRightSidebarCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error)

func DumpPacket

func DumpPacket(pk *scpacket.FeCommandPacketType)

func EvalBracketArgs

func EvalBracketArgs(origCmdStr string) (map[string]string, string, error)

func GetCmdStr

func GetCmdStr(pk *scpacket.FeCommandPacketType) string

func GetFullRemoteDisplayName

func GetFullRemoteDisplayName(rptr *sstore.RemotePtrType, rstate *remote.RemoteRuntimeState) string

func GetOsTypeFromRuntime

func GetOsTypeFromRuntime() string

func GetUITermOpts

func GetUITermOpts(winSize *packet.WinSize, ptermStr string) (*packet.TermOpts, error)

func IsReturnStateCommand

func IsReturnStateCommand(cmdStr string) bool

detects: export, declare, ., source, X=1, unset

func IsSudoCommand

func IsSudoCommand(cmdStr string) bool

func MakeReadFileUrl

func MakeReadFileUrl(screenId string, lineId string, filePath string) (string, error)

func RemoteResetCommand

func RemoteResetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (rtnUpdate scbus.UpdatePacket, rtnErr error)

func SubMetaCmd

func SubMetaCmd(cmd string) string

Types

type BareMetaCmdDecl

type BareMetaCmdDecl struct {
	CmdStr  string
	MetaCmd string
}

type ColMeta

type ColMeta struct {
	Title   string
	MinCols int
	MaxCols int
}

type HostInfoType

type HostInfoType struct {
	Host          string
	User          string
	CanonicalName string
	Port          int
	SshKeyFile    string
	ConnectMode   string
	Ignore        bool
	ShellPref     string
}

func NewHostInfo

func NewHostInfo(hostName string) (*HostInfoType, error)

type MainViewUpdate

type MainViewUpdate struct {
	MainView      string                     `json:"mainview"`
	HistoryView   *history.HistoryViewData   `json:"historyview,omitempty"`
	BookmarksView *bookmarks.BookmarksUpdate `json:"bookmarksview,omitempty"`
}

func (MainViewUpdate) GetType

func (MainViewUpdate) GetType() string

type MetaCmdEntryType

type MetaCmdEntryType struct {
	IsAlias bool
	Fn      MetaCmdFnType
}

type MetaCmdFnType

type MetaCmdFnType = func(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error)

type PTermOptsType

type PTermOptsType struct {
	Rows     string
	RowsFlex bool
	Cols     string
	ColsFlex bool
}

type RemoteEditArgs

type RemoteEditArgs struct {
	CanonicalName string
	SSHOpts       *sstore.SSHOpts
	ConnectMode   string
	Alias         string
	AutoInstall   bool
	Color         string
	ShellPref     string
	EditMap       map[string]interface{}
}

type ResolveItem

type ResolveItem = sstore.ResolveItem

type ResolvedRemote

type ResolvedRemote struct {
	DisplayName string
	RemotePtr   sstore.RemotePtrType
	Waveshell   *remote.WaveshellProc
	RState      remote.RemoteRuntimeState
	RemoteCopy  *sstore.RemoteType
	ShellType   string // default remote shell preference
	StatePtr    *packet.ShellStatePtr
	FeState     map[string]string
}

func ResolveRemoteFromPtr

func ResolveRemoteFromPtr(ctx context.Context, rptr *sstore.RemotePtrType, sessionId string, screenId string) (*ResolvedRemote, error)

type SetVarScope

type SetVarScope struct {
	ScopeName string
	VarNames  []string
}

Jump to

Keyboard shortcuts

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