cy

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 45 Imported by: 0

README

cy

Package cy contains cy's server and Janet API.

Documentation

Index

Constants

View Source
const (
	REPLAY_PROMPT = "\033Pcy\033\\\033[0;31m▸▸cy▹\033[0m \033[0;31m\033[0m\033[00m"
)

Variables

View Source
var (
	CONTEXT_ENV   = "CY"
	CONTEXT_REGEX = regexp.MustCompile("^(?P<socket>\\w+):(?P<id>\\d+)$")
	// Regex used for validating socket names, which must be alphanumeric and not
	// contain spaces.
	SOCKET_REGEX = regexp.MustCompile("^(\\w+)$")
)
View Source
var CY_BOOT embed.FS
View Source
var DOCS_CY string
View Source
var THEME_STORY_SETUP string

Functions

func FindConfig added in v0.1.13

func FindConfig() string

func FindDataDir added in v0.1.13

func FindDataDir() string

Types

type Client

type Client struct {
	deadlock.RWMutex
	util.Lifetime
	// contains filtered or unexported fields
}

func (*Client) Attach

func (c *Client) Attach(node tree.Node) error

Attach attaches to the given node and (as distinct from attach()) adds an entry to the client's node history.

func (*Client) Binds added in v0.1.11

func (c *Client) Binds() (binds []api.Binding)

func (*Client) Detach

func (c *Client) Detach()

func (*Client) Frame added in v0.1.6

func (c *Client) Frame() *frames.Framer

func (*Client) Get added in v0.1.10

func (c *Client) Get(key string) (value interface{}, ok bool)

func (*Client) GetLayout added in v0.4.0

func (c *Client) GetLayout() layout.Layout

func (*Client) HistoryBackward added in v0.2.0

func (c *Client) HistoryBackward() error

HistoryForward moves backward in the client's node history and attaches to the node they were attached to before the current one.

func (*Client) HistoryForward added in v0.2.0

func (c *Client) HistoryForward() error

HistoryForward moves forward in the client's node history. This has no effect if they are already at the latest entry.

func (*Client) Kill added in v0.2.0

func (c *Client) Kill()

func (*Client) Node

func (c *Client) Node() tree.Node

func (*Client) OuterLayers added in v0.1.6

func (c *Client) OuterLayers() *screen.Layers

func (*Client) Params added in v0.1.6

func (c *Client) Params() *params.Parameters

func (*Client) Read added in v0.1.10

func (c *Client) Read(p []byte) (n int, err error)

func (*Client) Resize

func (c *Client) Resize(size geom.Vec2) error

func (*Client) SetLayout added in v0.4.0

func (c *Client) SetLayout(l layout.Layout) error

SetLayout sets the layout in the client's LayoutEngine to the one provided. If the tree node the client is attached to in the layout exists, SetLayout also updates the client's bindings and params to point to that node. If it does not exist, the client uses the bindings and parameters of the root node.

func (*Client) Toast added in v0.2.0

func (c *Client) Toast(toast toasts.Toast)

func (*Client) Write added in v0.1.10

func (c *Client) Write(data []byte) (n int, err error)

type ClientID added in v0.1.6

type ClientID = int32

type ClientOptions added in v0.1.10

type ClientOptions = P.HandshakeMessage

type Cy

type Cy struct {
	util.Lifetime
	deadlock.RWMutex
	*janet.VM
	// contains filtered or unexported fields
}

func NewTestServer added in v0.2.0

func NewTestServer() (*Cy, func(geom.Size) (*Client, error), error)

func Start

func Start(ctx context.Context, options Options) (*Cy, error)

func (*Cy) ExecuteJanet added in v0.1.13

func (c *Cy) ExecuteJanet(path string) error

func (*Cy) ExecuteOnBehalf added in v0.9.0

func (c *Cy) ExecuteOnBehalf(
	ctx context.Context,
	node tree.NodeID,
	code []byte,
	path string,
) (*janet.Value, error)

func (*Cy) InferClient added in v0.9.0

func (c *Cy) InferClient(node tree.NodeID) (client *Client, found bool)

InferClient returns the client that most recently interacted with the given node. This uses the same strategy tmux does.

func (*Cy) Log added in v0.2.0

func (c *Cy) Log(level zerolog.Level, message string)

func (*Cy) NewClient added in v0.1.10

func (c *Cy) NewClient(ctx context.Context, options ClientOptions) (*Client, error)

func (*Cy) Output added in v0.9.0

func (c *Cy) Output(node tree.NodeID, index int) ([]byte, error)

Output returns everything that was written by a command at the given index in the node's scrollback.

func (*Cy) RerenderClients added in v1.1.0

func (c *Cy) RerenderClients()

RerenderClients triggers a rerender of all clients.

func (*Cy) Shutdown

func (c *Cy) Shutdown() error

func (*Cy) SocketName added in v0.9.0

func (c *Cy) SocketName() string

type CyModule added in v0.1.6

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

func (*CyModule) CpuProfile added in v0.7.0

func (c *CyModule) CpuProfile(user interface{}) error

func (*CyModule) Detach added in v0.1.6

func (c *CyModule) Detach(user interface{})

func (*CyModule) Documentation added in v0.1.6

func (i *CyModule) Documentation() string

func (*CyModule) KillServer added in v0.1.6

func (c *CyModule) KillServer()

func (*CyModule) Paste added in v0.1.6

func (c *CyModule) Paste(user interface{})

func (*CyModule) ReloadConfig added in v0.1.13

func (c *CyModule) ReloadConfig() error

func (*CyModule) Trace added in v0.7.0

func (c *CyModule) Trace(user interface{}) error

type Environment added in v0.1.6

type Environment map[string]string

func (Environment) Default added in v0.1.6

func (e Environment) Default(key string, defaultValue string) string

func (Environment) Get added in v0.1.6

func (e Environment) Get(key string) (string, bool)

func (Environment) IsSet added in v0.1.6

func (e Environment) IsSet(key string) bool

type Options

type Options struct {
	// The initial Janet script, typically ~/.cyrc.janet.
	Config string
	// The default directory in which to store data (e.g. recorded
	// sessions).
	DataDir string
	// The default shell
	Shell string
	// Whether to show the splash screen on client join
	HideSplash bool
	// Whether to skip blocking (input/*) API calls. Just for testing.
	SkipInput bool
	// The path to the Unix domain socket for this server.
	SocketPath string
	// The name of the socket (before calculating the real path.)
	SocketName string
}

type ToastLogger added in v0.1.5

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

func NewToastLogger added in v0.1.5

func NewToastLogger(send func(toasts.Toast)) *ToastLogger

func (*ToastLogger) Error added in v0.1.5

func (t *ToastLogger) Error(msg string)

func (*ToastLogger) Info added in v0.1.5

func (t *ToastLogger) Info(msg string)

func (*ToastLogger) Send added in v0.1.5

func (t *ToastLogger) Send(toast toasts.Toast)

func (*ToastLogger) Warn added in v0.1.5

func (t *ToastLogger) Warn(msg string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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