shell

package
v2.46.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CommandRunner                           = crcos.NewLocalCommandRunner()
	WindowsSubsystemLinuxKernelMetadataFile = "/proc/version"
)
View Source
var (
	ErrUnknownShell = errors.New("Error: Unknown shell")
)

Functions

func GenerateUsageHint

func GenerateUsageHint(userShell, cmdLine string) string

func GenerateUsageHintWithComment

func GenerateUsageHintWithComment(userShell, cmdLine string) string

func GetEnvString

func GetEnvString(userShell string, envName string, envValue string) string

func GetPathEnvString

func GetPathEnvString(userShell string, prependedPath string) string

func GetShell

func GetShell(userShell string) (string, error)

func IsWindowsSubsystemLinux added in v2.46.0

func IsWindowsSubsystemLinux() bool

IsWindowsSubsystemLinux detects whether current system is using Windows Subsystem for Linux or not

It checks for these conditions to make sure that current system has WSL installed: - `/proc/version` file is present - `/proc/version` file contents contain keywords `Microsoft` and `WSL`

It above conditions are met, then this method returns `true` otherwise `false`.

Types

type Config

type Config struct {
	Prefix     string
	Delimiter  string
	Suffix     string
	PathSuffix string
}

Jump to

Keyboard shortcuts

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