alias

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 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 Install

func Install(shell string) 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 IsSupported

func IsSupported(shell string) bool

IsSupported returns true if Granted supports configuring aliases automatically for a user's shell

func MustBeConfigured

func MustBeConfigured() error

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

func Require

func Require(cmd *cli.Command) *cli.Command

Require takes a urfave/cli command and wraps it's Action in "middleware" requiring the Granted alias to be set up.

func Uninstall

func Uninstall(shell string) error

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

Types

type Config

type Config struct {
	// Alias is the text to insert into the File for setting up the sourcing command for Granted
	Alias string
	File  string
}

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 SetupShellResults

type SetupShellResults struct {
	ConfigFile string
}

func SetupShellWizard

func SetupShellWizard() (*SetupShellResults, error)

type UninstallShellResults

type UninstallShellResults struct {
	ConfigFile string
}

func UninstallDefaultShellAlias

func UninstallDefaultShellAlias() (*UninstallShellResults, error)

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

Jump to

Keyboard shortcuts

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