shell

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorStruct

type ErrorStruct struct {
	Code    string `json:"code"`
	Summary string `json:"summary"`
	Detail  string `json:"detail"`
}

ErrorStruct defines contents of NPMErrorResponse.

type NPMErrorResponse

type NPMErrorResponse struct {
	ErrorBlock ErrorStruct `json:"error"`
}

NPMErrorResponse is the JSON response for an npm command when it errors.

type OSContext

type OSContext interface {
	RunCommand(name string, args ...string) (bytes.Buffer, error)
	RunCommandBytes(name string, args ...string) ([]byte, error)
	RunCommandString(name string, args ...string) (string, error)
	GetHomeDir() (string, error)
}

OSContext interface for running CLI commands.

func NewOSContext

func NewOSContext() OSContext

NewOSContext creates an instance of OSContextImpl.

type OSContextImpl

type OSContextImpl struct {
}

OSContextImpl an implementation for OSContext using os/exec.

func (*OSContextImpl) GetHomeDir

func (os *OSContextImpl) GetHomeDir() (string, error)

GetHomeDir fetches current user and gets its home directory.

func (*OSContextImpl) RunCommand

func (os *OSContextImpl) RunCommand(name string, args ...string) (bytes.Buffer, error)

RunCommand used instead of exec.Command.

func (*OSContextImpl) RunCommandBytes

func (os *OSContextImpl) RunCommandBytes(name string, args ...string) ([]byte, error)

RunCommandBytes used instead of exec.Command.

func (*OSContextImpl) RunCommandString

func (os *OSContextImpl) RunCommandString(name string, args ...string) (string, error)

RunCommandString used instead of exec.Command.

Jump to

Keyboard shortcuts

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