worlds

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBriefRoot errNoBriefRoot

ErrNoBriefRoot indicates that there has been no error with the filesystem API but in the Brief semantics no briefroot has been found.

Functions

This section is empty.

Types

type Env

type Env []string

like "os/exec".Cmd.Env

func OSEnv

func OSEnv(keywhitelist ...string) (Env, error)

func (Env) Clone

func (env Env) Clone() Env

Env(nil).Clone()==Env(nil) holds.

func (Env) Getenv

func (env Env) Getenv(key string) string

like os.Getenv

func (Env) LookupEnv

func (env Env) LookupEnv(key string) (string, bool)

like os.LookupEnv

func (*Env) Setenv

func (env *Env) Setenv(key, value string) error

like os.Setenv

type World

type World struct {
	// of "path" (not "path/filepath") style
	// relative
	Cwd string

	// "PWD" key is ignored
	Env

	vfs.FS

	// may be nil
	PasswordSource vault.PasswordSource

	// may be nil
	Stdout io.Writer

	StdoutUnderstandsANSI bool
	Stderr                io.Writer

	// may be nil
	NowFunc func() time.Time

	// may be nil
	// [2024-02-13, jfrech] TODO s/LocalTimezone/LocalTimezoneFunc/
	LocalTimezone *time.Location

	// may be nil
	InterpretAddrishFunc func(addrish string) (*netmail.Address, error)

	InterpretMsgidishFunc func(msgidish string) (msgs.MessageId, error)
}

func OS

func OS() (*World, error)

func OSEntire

func OSEntire() (*World, error)

OSEntire returns the view of the entire operating system, with its filesystem unrestrictedly rooted at "/". See (*World).EnterBriefRoot to restrict a *World's view.

Used primarily internally and by "brief init".

func (*World) BriefRoot

func (world *World) BriefRoot() (briefroot string, relativecwd string, err error)

func (*World) BriefRoot0

func (world *World) BriefRoot0() (string, error)

on nil error, the returned string may be a briefroot or may need traversal furhter back which might result in a briefroot

BriefRoot0 should only be called by "brief init" and BriefRoot

func (*World) Getwd

func (world *World) Getwd() (string, error)

func (*World) InterpretAddrish

func (world *World) InterpretAddrish(addrish string) (*netmail.Address, error)

func (*World) InterpretMsgidish

func (world *World) InterpretMsgidish(msgidish string) (msgs.MessageId, error)

func (*World) LocalTimezoneOrTimeDotLocal

func (world *World) LocalTimezoneOrTimeDotLocal() *time.Location

TODO **UGLY** name

func (*World) Now

func (world *World) Now() time.Time

func (*World) Sack

func (world *World) Sack() (sacks.Sack, error)

TODO maybe have a (*World).AlternateSack when one does not want the vfs-based fssack?

func (*World) Write

func (world *World) Write(p []byte) (int, error)

Writes to a world without a connected Stdout will be silently discarded.

[2024-01-14, jfrech] TODO Is this a sound design?

Jump to

Keyboard shortcuts

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