Documentation ¶
Index ¶
- func DepArraysMatch(d1, d2 []*Dependency) bool
- func FileExists(filename string) bool
- func Kill(cmd *exec.Cmd) error
- func KindFlagMap() map[string]string
- func KindKeyMap() map[string]string
- func NewDummyAppConfig() *config.AppConfig
- func NewDummyLog() *logrus.Entry
- func RunLineOutputCmd(cmd *exec.Cmd, onLine func(line string) (bool, error)) error
- func WrapError(err error) error
- type Author
- type CommandView
- type CommandViewMap
- type Dependency
- type KindFlag
- type NpmManager
- func (m *NpmManager) ChdirToPackageRoot() (bool, error)
- func (m *NpmManager) EditDepConstraint(dep *Dependency, packageJsonPath string, constraint string) error
- func (m *NpmManager) EditOrAddScript(scriptName string, packageJsonPath string, newName string, newCommand string) error
- func (m *NpmManager) GetDeps(currentPkg *Package, previousDeps []*Dependency) ([]*Dependency, error)
- func (m *NpmManager) GetPackages(paths []string, previousPackages []*Package) ([]*Package, error)
- func (m *NpmManager) GetTarballs(currentPkg *Package) ([]*Tarball, error)
- func (m *NpmManager) IsLinked(name string, path string) (bool, error)
- func (m *NpmManager) RemoveScript(scriptName string, packageJsonPath string) error
- type OSCommand
- func (c *OSCommand) AppendLineToFile(filename, line string) error
- func (c *OSCommand) CreateFileWithContent(path string, content string) error
- func (c *OSCommand) CreateTempFile(filename, content string) (string, error)
- func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error)
- func (c *OSCommand) ExecutableFromString(commandStr string) *exec.Cmd
- func (c *OSCommand) FileType(path string) string
- func (c *OSCommand) GetLazynpmPath() string
- func (c *OSCommand) OpenFile(filename string) error
- func (c *OSCommand) OpenLink(link string) error
- func (c *OSCommand) PipeCommands(commandStrings ...string) error
- func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) *exec.Cmd
- func (c *OSCommand) Quote(message string) string
- func (c *OSCommand) Remove(filename string) error
- func (c *OSCommand) RunCommand(formatString string, formatArgs ...interface{}) error
- func (c *OSCommand) RunCommandWithOptions(command string, options RunCommandOptions) error
- func (c *OSCommand) RunCommandWithOutput(formatString string, formatArgs ...interface{}) (string, error)
- func (c *OSCommand) RunCommandWithOutputWithOptions(command string, options RunCommandOptions) (string, error)
- func (c *OSCommand) RunCustomCommand(command string) *exec.Cmd
- func (c *OSCommand) RunDirectCommand(command string) (string, error)
- func (c *OSCommand) RunExecutable(cmd *exec.Cmd) error
- func (c *OSCommand) RunExecutableWithOutput(cmd *exec.Cmd) (string, error)
- func (c *OSCommand) RunPreparedCommand(cmd *exec.Cmd) error
- func (c *OSCommand) SetBeforeExecuteCmd(cmd func(*exec.Cmd))
- func (c *OSCommand) SetCommand(cmd func(string, ...string) *exec.Cmd)
- func (c *OSCommand) Unquote(message string) string
- type Package
- type PackageConfig
- type Platform
- type Repository
- type RunCommandOptions
- type Script
- type Tarball
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DepArraysMatch ¶
func DepArraysMatch(d1, d2 []*Dependency) bool
func FileExists ¶
func KindFlagMap ¶
func KindKeyMap ¶
func NewDummyAppConfig ¶
NewDummyAppConfig creates a new dummy AppConfig for testing
func RunLineOutputCmd ¶
Types ¶
type Author ¶
type CommandView ¶
type CommandView struct { // not super keen on having this dependency on gocui here but alas View *gocui.View Cmd *exec.Cmd Cancelled bool }
func (*CommandView) Running ¶
func (cv *CommandView) Running() bool
func (*CommandView) Status ¶
func (cv *CommandView) Status() string
type CommandViewMap ¶
type CommandViewMap map[string]*CommandView
type Dependency ¶
type Dependency struct { Name string Constraint string LinkPath string Present bool PackageConfig *PackageConfig Path string Kind string ParentPackagePath string }
func (*Dependency) ConfigPath ¶
func (d *Dependency) ConfigPath() string
func (*Dependency) ID ¶
func (d *Dependency) ID() string
func (*Dependency) KindKey ¶
func (d *Dependency) KindKey() string
func (*Dependency) Linked ¶
func (d *Dependency) Linked() bool
type NpmManager ¶
type NpmManager struct { Log *logrus.Entry OSCommand *OSCommand Tr *i18n.Localizer Config config.AppConfigurer NpmRoot string }
NpmManager is our main git interface
func NewDummyNpmManager ¶
func NewDummyNpmManager() *NpmManager
NewDummyNpmManager creates a new dummy NpmManager for testing
func NewDummyNpmManagerWithOSCommand ¶
func NewDummyNpmManagerWithOSCommand(osCommand *OSCommand) *NpmManager
NewDummyNpmManagerWithOSCommand creates a new dummy NpmManager for testing
func NewNpmManager ¶
func NewNpmManager(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Localizer, config config.AppConfigurer) (*NpmManager, error)
NewNpmManager it runs git commands
func (*NpmManager) ChdirToPackageRoot ¶
func (m *NpmManager) ChdirToPackageRoot() (bool, error)
func (*NpmManager) EditDepConstraint ¶
func (m *NpmManager) EditDepConstraint(dep *Dependency, packageJsonPath string, constraint string) error
func (*NpmManager) EditOrAddScript ¶
func (*NpmManager) GetDeps ¶
func (m *NpmManager) GetDeps(currentPkg *Package, previousDeps []*Dependency) ([]*Dependency, error)
func (*NpmManager) GetPackages ¶
func (m *NpmManager) GetPackages(paths []string, previousPackages []*Package) ([]*Package, error)
func (*NpmManager) GetTarballs ¶
func (m *NpmManager) GetTarballs(currentPkg *Package) ([]*Tarball, error)
func (*NpmManager) RemoveScript ¶
func (m *NpmManager) RemoveScript(scriptName string, packageJsonPath string) error
type OSCommand ¶
type OSCommand struct { Log *logrus.Entry Platform *Platform Config config.AppConfigurer // contains filtered or unexported fields }
OSCommand holds all the os commands
func NewDummyOSCommand ¶
func NewDummyOSCommand() *OSCommand
NewDummyOSCommand creates a new dummy OSCommand for testing
func NewOSCommand ¶
func NewOSCommand(log *logrus.Entry, config config.AppConfigurer) *OSCommand
NewOSCommand os command runner
func (*OSCommand) AppendLineToFile ¶
AppendLineToFile adds a new line in file
func (*OSCommand) CreateFileWithContent ¶
CreateFileWithContent creates a file with the given content
func (*OSCommand) CreateTempFile ¶
CreateTempFile writes a string to a new temp file and returns the file's name
func (*OSCommand) EditFile ¶
EditFile opens a file in a subprocess using whatever editor is available, falling back to core.editor, VISUAL, EDITOR, then vi
func (*OSCommand) ExecutableFromString ¶
ExecutableFromString takes a string like `git status` and returns an executable command for it
func (*OSCommand) GetLazynpmPath ¶
GetLazynpmPath returns the path of the currently executed file
func (*OSCommand) PipeCommands ¶
PipeCommands runs a heap of commands and pipes their inputs/outputs together like A | B | C
func (*OSCommand) PrepareSubProcess ¶
PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it TODO: see if this needs to exist, given that ExecutableFromString does the same things
func (*OSCommand) RunCommand ¶
RunCommand runs a command and just returns the error
func (*OSCommand) RunCommandWithOptions ¶
func (c *OSCommand) RunCommandWithOptions(command string, options RunCommandOptions) error
func (*OSCommand) RunCommandWithOutput ¶
func (c *OSCommand) RunCommandWithOutput(formatString string, formatArgs ...interface{}) (string, error)
RunCommandWithOutput wrapper around commands returning their output and error NOTE: If you don't pass any formatArgs we'll just use the command directly, however there's a bizarre compiler error/warning when you pass in a formatString with a percent sign because it thinks it's supposed to be a formatString when in that case it's not. To get around that error you'll need to define the string in a variable and pass the variable into RunCommandWithOutput.
func (*OSCommand) RunCommandWithOutputWithOptions ¶
func (c *OSCommand) RunCommandWithOutputWithOptions(command string, options RunCommandOptions) (string, error)
func (*OSCommand) RunCustomCommand ¶
RunCustomCommand returns the pointer to a custom command
func (*OSCommand) RunDirectCommand ¶
RunDirectCommand wrapper around direct commands
func (*OSCommand) RunExecutable ¶
RunExecutable runs an executable file and returns an error if there was one
func (*OSCommand) RunExecutableWithOutput ¶
RunExecutableWithOutput runs an executable file and returns its output
func (*OSCommand) RunPreparedCommand ¶
RunPreparedCommand takes a pointer to an exec.Cmd and runs it this is useful if you need to give your command some environment variables before running it
func (*OSCommand) SetBeforeExecuteCmd ¶
func (*OSCommand) SetCommand ¶
SetCommand sets the command function used by the struct. To be used for testing only
type Package ¶
type Package struct { Config PackageConfig Path string // for when something is linked to the global node_modules folder LinkedGlobally bool }
func (*Package) ConfigPath ¶
func (*Package) SortedDependencies ¶
func (p *Package) SortedDependencies(previousDeps []*Dependency) []*Dependency
func (*Package) SortedScripts ¶
type PackageConfig ¶
type PackageConfig struct { // this is the sha256 of the pakage.json file Sha []byte Name string Version string License string Description string Homepage string Main string Deprecated bool Private bool Files []string Keywords []string Os []string Cpu []string BundledDependencies []string Scripts map[string]string Directories map[string]string Dependencies map[string]string DevDependencies map[string]string PeerDependencies map[string]string OptionalDependencies map[string]string SortedDependencies []*Dependency Engines struct { Node string Npm string } Repository Repository Author Author Contributors []Author Bugs struct { Url string `json:"url"` } }
func UnmarshalPackageConfig ¶
func UnmarshalPackageConfig(r io.Reader, previousPackageConfig *PackageConfig) (*PackageConfig, error)
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform stores the os state
type Repository ¶
type Repository struct { Type string `json:"type"` Url string `json:"url"` // if a string rather than an object was given we'll store it in SingleLine SingleLine string }
func (Repository) ToString ¶
func (r Repository) ToString() string
type RunCommandOptions ¶
type RunCommandOptions struct {
EnvVars []string
}