commands

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2014 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Text = iota
	Json
)

type of output format for commands

View Source
const (
	Mercurial = iota
	Source
	Binary
)

possible installation sources

Variables

View Source
var ErrNotInstalled = errors.New("Go version not installed")

error used when Go version used for mkenv is not installed yet

Functions

func IsNotInstalledError

func IsNotInstalledError(err error) bool

determine if the given error is of ErrNotInstalled type

Types

type BriefJSON

type BriefJSON struct {
	Installed []string `json:"installed"`
	Available []string `json:"available"`
}

json brief output structure

type EnvironmentsJSON

type EnvironmentsJSON struct {
	Available []string `json:"available"`
	Invalid   []string `json:"invalid"`
}

type EnvironmentsList

type EnvironmentsList struct {
	DisplayAs int
}

EnvironmentsList command

func NewEnvironmentsList

func NewEnvironmentsList(options ...func(*EnvironmentsList)) *EnvironmentsList

Create a new lsenv adn returns back it's address

func (*EnvironmentsList) Run

func (e *EnvironmentsList) Run() (string, error)

implements the Runner interface returning back a list of available environments in text or json format depending on the given options

type Export

type Export struct {
	Environment string
	Name        string
	Force       bool
	Prettify    bool
	// contains filtered or unexported fields
}

export command

func NewExport

func NewExport(options ...func(e *Export)) *Export

create a new export command and return back it's address

func (*Export) Err

func (e *Export) Err() error

expose the internal err property

func (*Export) Exists

func (e *Export) Exists() bool

check if a manifest already exists for the given environment

func (*Export) LoadEnvironment

func (e *Export) LoadEnvironment() (*env.Environment, error)

load environment using the activate environment script, return an error if the operation can't be completed

func (*Export) Run

func (e *Export) Run() (string, error)

implements the Runner interface executing the environment export

type Import

type Import struct {
	Manifest string
	Prompt   string
	Verbose  bool
	Force    bool
}

func NewImport

func NewImport(options ...func(i *Import)) *Import

create a new import command and return back it's address

func (*Import) Run

func (i *Import) Run() (string, error)

implements the Runner interface importing and recreating an exported env

type Install

type Install struct {
	Force     bool
	Source    int
	Version   string
	DisplayAs int
	Verbose   bool
}

instal command

func NewInstall

func NewInstall(options ...func(i *Install)) *Install

Create a new install command and return back it's address

func (*Install) Run

func (i *Install) Run() (string, error)

implements the Runner interface executing the required installation

type List

type List struct {
	ShowInstalled    bool
	ShowNotInstalled bool
	ShowBoth         bool
	DisplayAs        int
}

list command

func NewList

func NewList(options ...func(*List)) *List

Create a new list and return back it's address

func (*List) Run

func (l *List) Run() (string, error)

implements the Runner interface returning back a list of installed go versions, a list of not installed versions or all versions depending on the list options

type Mkenv

type Mkenv struct {
	Force   bool
	Name    string
	Prompt  string
	Version string
}

mkenv command

func NewMkenv

func NewMkenv(options ...func(i *Mkenv)) *Mkenv

Create a new mkenv command and return back it's address

func (*Mkenv) Run

func (m *Mkenv) Run() (string, error)

implements the Runner interface creating the new virtual environment

type Runner

type Runner interface {
	Run() (string, error)
}

Runner is a interface that wraps the execution of a command

Runner returns a string (that can be empty) with the results of the executed command and an error, that should be nil if no error occurred

Jump to

Keyboard shortcuts

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