package commandlineprompter

import "github.com/oslokommune/okctl/pkg/virtualenv/commandlineprompter"

Package commandlineprompter implements functionality for setting the command prompt (PS1) for various shells

Index

Constants

const (
	// Ps1Dir is the name of the directory where the PS1 executable will be stored
	Ps1Dir = "venv"

	// Ps1Filename is the file name of the PS1 executable that returns data to be put into the command prompt
	Ps1Filename = "venv_ps1"
)

Functions

func NewShellGetter

func NewShellGetter(opts CommandLinePromptOpts) *shellgetter.ShellGetter

NewShellGetter creates a new ShellGetter

Types

type CommandLinePrompt

type CommandLinePrompt struct {
	Warning string
	Env     map[string]string
}

CommandLinePrompt contains environment variables needed by the command prompt, and possibly a warning about issues with the returned command prompt.

type CommandLinePromptOpts

type CommandLinePromptOpts struct {
	Os                   shellgetter.Os
	MacOsUserShellGetter shellgetter.MacOsUserShellCmdGetter
	OsEnvVars            map[string]string
	EtcStorage           storage.Storer
	UserDirStorage       storage.Storer
	UserHomeDirStorage   storage.Storer
	TmpStorage           storage.Storer
	ClusterName          string
	CurrentUsername      string
}

CommandLinePromptOpts contains the required inputs to create a command line prompt

type CommandLinePrompter

type CommandLinePrompter interface {
	CreatePrompt() (CommandLinePrompt, error)
}

CommandLinePrompter defines functionality for creating a command line prompt

func New

New creates a new command line prompter

Source Files

command_line_prompts_opts.go commandlineprompter.go noopprompter.go prompter_bash.go prompter_zsh.go

Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
7 packages
Last checked
18 hours ago

Tools for package owners.