shell

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ScriptFinalLine = "# End of Magic Alias"
View Source
const ScriptFirstLine = "# Magic Alias (ma)"

Variables

View Source
var MagicAliasPath string

Functions

func AddAlias

func AddAlias(alias string, command string) error

func GetAliasCommand added in v0.0.2

func GetAliasCommand(alias string) (string, error)

GetAliasCommand reads the alias file and extracts the command

func GetAliasPath

func GetAliasPath(alias string) string

GetAliasPath returns the full path to an alias file

func GetShell

func GetShell() (string, error)

func GetShellName

func GetShellName() (string, error)

func GetShellRcPath

func GetShellRcPath() (string, error)

func IsMagicAliasInPath

func IsMagicAliasInPath() (bool, error)

func ListAliases

func ListAliases() ([]string, error)

func RemoveAlias

func RemoveAlias(alias string) error

func RemoveMagicAliasFromRc

func RemoveMagicAliasFromRc(rcPath string) error

RemoveMagicAliasFromRc removes the magic alias PATH export from the rc file

func RemoveScriptContent

func RemoveScriptContent(content string) string

RemoveScriptContent removes all content between ScriptFirstLine and ScriptFinalLine (inclusive) from the provided string and returns the result

func RenderScriptContent

func RenderScriptContent(shell string) (string, error)

func WriteMagicAliasToRc

func WriteMagicAliasToRc(shell string) error

func WriteMagicAliasToRcPath

func WriteMagicAliasToRcPath(shell, rcPath string) error

Types

type ScriptContentArgs

type ScriptContentArgs struct {
	FirstLine string
	Shell     string
	FinalLine string
}

Jump to

Keyboard shortcuts

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