shell

package
v0.0.0-...-8bceaef Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRecognizableShellFound = errors.New("SHELL in undefined, and couldn't find any common shells in PATH")

Functions

func MapToPairs

func MapToPairs(m map[string]string) []string

func PairsToMap

func PairsToMap(pairs []string) map[string]string

PairsToMap creates a map from a slice of "key=value" environment variable pairs. Note that maps are not ordered, which can affect the final variable values when pairs contains duplicate keys.

Types

type AddOpts

type AddOpts struct {
	AllowInsecure    []string
	Platforms        []string
	ExcludePlatforms []string
	DisablePlugin    bool
	Patch            string
	Outputs          []string
}

type Credentials

type Credentials struct {
	IDToken string
	// TODO We can just parse these out, but don't want to add a dependency right now
	Email string
	Sub   string
}

type EnvExportsOpts

type EnvExportsOpts struct {
	EnvOptions     EnvOptions
	NoRefreshAlias bool
	RunHooks       bool
}

type EnvFlags

type EnvFlags struct {
	EnvMap  map[string]string
	EnvFile string
}

type EnvOptions

type EnvOptions struct {
	Hooks             LifecycleHooks
	OmitNixEnv        bool
	PreservePathStack bool
	Pure              bool
	SkipRecompute     bool
}

EnvOptions configure the Inkube Environment in the `computeEnv` function. - These options are commonly set by flags in some Inkube commands like `shellenv`, `shell` and `run`. - The struct is designed for the "common case" to be zero-initialized as `EnvOptions{}`.

type GenerateOpts

type GenerateOpts struct {
	ForType  string
	Force    bool
	RootUser bool
}

type Inkube

type Inkube struct{}

func (*Inkube) NewShell

func (d *Inkube) NewShell(envOpts EnvOptions, opts ...ShellOption) (*InkubeShell, error)

newShell initializes the InkubeShell struct so it can be used to start a shell environment for the inkube project.

type InkubeShell

type InkubeShell struct {
	Inkube          *Inkube
	Name            name
	BinPath         string
	ProjectDir      string // path to where inkube.json config resides
	Env             map[string]string
	UserShellrcPath string

	HistoryFile string

	// ShellStartTime is the unix timestamp for when the command was invoked
	ShellStartTime time.Time
}

InkubeShell configures a user's shell to run in Inkube. Its zero value is a fallback shell that launches a regular Nix shell.

func (*InkubeShell) Run

func (s *InkubeShell) Run() error

type LifecycleHooks

type LifecycleHooks struct {
	// OnStaleState is called when the Inkube state is out of date
	OnStaleState func()
}

type Opts

type Opts struct {
	Dir                      string
	Env                      map[string]string
	Environment              string
	IgnoreWarnings           bool
	CustomProcessComposeFile string
	Stderr                   io.Writer
}

type ProcessComposeOpts

type ProcessComposeOpts struct {
	ExtraFlags         []string
	Background         bool
	ProcessComposePort int
}

type PullboxOpts

type PullboxOpts struct {
	Overwrite   bool
	URL         string
	Credentials Credentials
}

type ShellOption

type ShellOption func(*InkubeShell)

func WithEnvVariables

func WithEnvVariables(envVariables map[string]string) ShellOption

TODO: Consider removing this once plugins add env vars directly to binaries via wrapper scripts.

func WithHistoryFile

func WithHistoryFile(historyFile string) ShellOption

func WithProjectDir

func WithProjectDir(projectDir string) ShellOption

func WithShellStartTime

func WithShellStartTime(t time.Time) ShellOption

type UpdateOpts

type UpdateOpts struct {
	Pkgs                  []string
	NoInstall             bool
	IgnoreMissingPackages bool
}

Jump to

Keyboard shortcuts

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