alias

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package alias sets up the shell alias for Granted. The alias is required so that the Granted wrapper script (scripts/granted in this repository) is sourced rather than executed. By sourcing the wrapper script we can export environment variables into the user's shell after they call the Granted CLI. These variables are typically used for cloud provider session credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultAlias

func GetDefaultAlias() string

func GetFishAlias

func GetFishAlias() string

func GetShellFromShellEnv added in v0.2.1

func GetShellFromShellEnv(shellEnv string) (string, error)

GetShellFromShellEnv returns the shell from the SHELL environment variable

func Install

func Install(cfg Config) error

Install the Granted alias to a config file for a specified shell.

func IsConfigured

func IsConfigured() bool

IsConfigured returns whether the shell alias is correctly set up for Granted.

func MustBeConfigured

func MustBeConfigured(autoConfigure bool) error

MustBeConfigured displays a helpful error message and exits the CLI if the alias is detected as not being configured properly.

func SetupShellWizard

func SetupShellWizard(autoConfigure bool) error

func Uninstall

func Uninstall(cfg Config) error

Uninstall the Granted alias to a config file for a specified shell.

func UninstallDefaultShellAlias

func UninstallDefaultShellAlias() error

UninstallDefaultShellAlias tries to uninstall the Granted aliases from the user's default shell bindings

Types

type Config

type Config struct {
	File  string
	Alias string
}

func GetShellAlias added in v0.2.1

func GetShellAlias(shell string) (Config, error)

GetShellAlias returns the alias config for a shell

type ErrAlreadyInstalled

type ErrAlreadyInstalled struct {
	File string
}

func (*ErrAlreadyInstalled) Error

func (e *ErrAlreadyInstalled) Error() string

type ErrNotInstalled

type ErrNotInstalled struct {
	File string
}

func (*ErrNotInstalled) Error

func (e *ErrNotInstalled) Error() string

type ErrShellNotSupported

type ErrShellNotSupported struct {
	Shell string
}

func (*ErrShellNotSupported) Error

func (e *ErrShellNotSupported) Error() string

type UninstallShellResults

type UninstallShellResults struct {
	ConfigFile string
}

Jump to

Keyboard shortcuts

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