context

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName      = "flow"
	HeaderCtxKey = "ctx"
)

Variables

This section is empty.

Functions

func ExpandRef

func ExpandRef(ctx *Context, ref executable.Ref) executable.Ref

Types

type Context

type Context struct {
	Config           *config.Config
	CurrentWorkspace *workspace.Workspace
	TUIContainer     *tuikit.Container
	WorkspacesCache  cache.WorkspaceCache
	ExecutableCache  cache.ExecutableCache

	// RootExecutable is the executable that is being run in the current context.
	// This will be nil if the context is not associated with an executable run.
	RootExecutable *executable.Executable

	// ProcessTmpDir is the temporary directory for the current process. If set, it will be
	// used to store temporary files all executable runs when the tmpDir value is specified.
	ProcessTmpDir string
	// contains filtered or unexported fields
}

func NewContext

func NewContext(ctx context.Context, cancelFunc context.CancelFunc, stdIn, stdOut *os.File) *Context

func (*Context) AddCallback added in v1.0.2

func (ctx *Context) AddCallback(callback func(*Context) error)

func (*Context) Cancel added in v1.1.0

func (ctx *Context) Cancel()

func (*Context) Deadline added in v1.1.0

func (ctx *Context) Deadline() (deadline time.Time, ok bool)

func (*Context) Done added in v1.1.0

func (ctx *Context) Done() <-chan struct{}

func (*Context) Err added in v1.1.0

func (ctx *Context) Err() error

func (*Context) Finalize

func (ctx *Context) Finalize()

func (*Context) SetContext added in v1.1.0

func (ctx *Context) SetContext(c context.Context, cancelFunc context.CancelFunc)

SetContext sets the context and cancel function for the Context. This function should NOT be used outside of tests! The context and cancel function should be set when creating the context.

func (*Context) SetIO

func (ctx *Context) SetIO(stdIn, stdOut *os.File)

SetIO sets the standard input and output for the context This function should NOT be used outside of tests! The standard input and output should be set when creating the context.

func (*Context) SetView

func (ctx *Context) SetView(view tuikit.View) error

func (*Context) StdIn

func (ctx *Context) StdIn() *os.File

func (*Context) StdOut

func (ctx *Context) StdOut() *os.File

func (*Context) String

func (ctx *Context) String() string

func (*Context) Value added in v1.1.0

func (ctx *Context) Value(key any) any

TODO: Move access to various context fields to this function

Jump to

Keyboard shortcuts

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