xplat

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 7 Imported by: 7

Documentation

Overview

Helper methods for supporting cross-platform shells.

This takes into account both the operating system and the shell environment that the process is running within. The following environments are supported: * Linux * MacOS * Windows with WSL/PowerShell/CMD/Git Bash (mingw)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectShell

func DetectShell() string

DetectShell uses environment variables to determine the containing shell environment.

Values: unknown, posix, mingw, powershell, cmd, $SHELL (e.g. sh, bash)

This is not guaranteed to always work depending on customizations to the default Windows environment variables. It uses the following heuristics: * MSYSTEM is set * SHELL is set * PSModulePath containing user's home directory

func EnsureInPath

func EnsureInPath(value string)

EnsureInPath adds the specified path to the beginning of the PATH environment variable when it is not already in PATH. Detects if this is an Azure CI build and exports the updated PATH.

func FileExt added in v0.4.0

func FileExt() string

FileExt returns the default file extension based on the operating system.

func GetMSystem

func GetMSystem() string

GetMSystem returns current the MSys2 subsystem.

Allowed values are: (empty), mingw32, mingw64, msys2.

func InPath

func InPath(value string) bool

InPath determines if the path is in the PATH environment variable.

func PrependPath

func PrependPath(value string)

PrependPath adds the specified path to the beginning of the PATH environment variable. Detects if this is an Azure CI build and exports the updated PATH.

Types

This section is empty.

Jump to

Keyboard shortcuts

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