got

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 15 Imported by: 0

README

got

Tool for managing commands written in Go.

Require

  • go >= 1.16
    • using go install command to install a specific version

Install

$ go get http://github.com/tennashi/got/cmd/got

Usage

NAME:
   got - package manager for commands written in Go

USAGE:
   got [global options] command [command options] [arguments...]

COMMANDS:
   install  install the specified package
   upgrade  upgrade installed packages
   list     list installed packages
   enable   enable the specified executable
   disable  disable the specified executable
   show     show the specified package
   pin      pin the version of specified package
   unpin    unpin the version of specified package
   remove   remove the specified package
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --config value, -c value  config file [$GOT_CONFIG_FILE]
   --debug                   debug mode (default: false) [$GOT_DEBUG]
   --help, -h                show help (default: false)
Install the command written in Go
$ got install github.com/tennashi/got # == go install github.com/tennashi/got/...@latest
$ got install tennashi/got # == go install github.com/tennashi/got/...@latest
Upgrade installed commands
$ got upgrade
List installed commands
$ got list

Configuration

Priority is given in the following order.

  • --config/-c command line option
  • $GOT_CONFIG_FILE
  • $XDG_CONFIG_HOME/got/config.toml
    • default(Linux): $HOME/.config/got/config.toml
install_all = true
bin_dir = "$GOBIN" # if $GOBIN is not defined, "$GOPATH/bin" is used
data_dir = "$XDG_DATA_HOME/got" # default: "$HOME/.local/share/got
  • install_all: Specifies whether to install all main packages under the specified module path
  • bin_dir: Directory to create symlinks for executables
  • data_dir: Directory of data to manage the installed modules and the executable files

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDebugLogger

func NewDebugLogger(out io.Writer, scope string, isDebug bool) *log.Logger

func NewLogger

func NewLogger(out io.Writer, scope string) *log.Logger

Types

type AlreadyExistsError

type AlreadyExistsError struct {
	Path string
}

func (*AlreadyExistsError) Error

func (e *AlreadyExistsError) Error() string

type AlreadyInstalledError

type AlreadyInstalledError struct {
	Path PackagePath
}

func (*AlreadyInstalledError) Error

func (e *AlreadyInstalledError) Error() string

type CommandExecutionError

type CommandExecutionError struct {
	Command string
	Message string
	Err     error
}

func (*CommandExecutionError) Error

func (e *CommandExecutionError) Error() string

func (*CommandExecutionError) Unwrap

func (e *CommandExecutionError) Unwrap() error

type DisableCommand added in v0.1.5

type DisableCommand struct {
	// contains filtered or unexported fields
}

func NewDisableCommand added in v0.1.5

func NewDisableCommand(ioStream *IOStream, cfg *DisableCommandConfig) (*DisableCommand, error)

func (*DisableCommand) Run added in v0.1.5

func (c *DisableCommand) Run(pkgName, execName string) error

type DisableCommandConfig added in v0.1.5

type DisableCommandConfig struct {
	DataDir string
	BinDir  string

	IsDebug bool
}

type EnableCommand added in v0.1.5

type EnableCommand struct {
	// contains filtered or unexported fields
}

func NewEnableCommand added in v0.1.5

func NewEnableCommand(ioStream *IOStream, cfg *EnableCommandConfig) (*EnableCommand, error)

func (*EnableCommand) Run added in v0.1.5

func (c *EnableCommand) Run(pkgName, execName string) error

type EnableCommandConfig added in v0.1.5

type EnableCommandConfig struct {
	DataDir string
	BinDir  string

	IsDebug bool
}

type Executable

type Executable struct {
	Name    string
	Path    string
	Disable bool
}

type ExecutableLinker

type ExecutableLinker struct {
	// contains filtered or unexported fields
}

func NewExecutableLinker

func NewExecutableLinker(ioStream *IOStream, cfg *ExecutableLinkerConfig) (*ExecutableLinker, error)
func (l *ExecutableLinker) ForceLink(executable *Executable) error
func (l *ExecutableLinker) Link(executable *Executable) error
func (l *ExecutableLinker) Unlink(executable *Executable) error

type ExecutableLinkerConfig

type ExecutableLinkerConfig struct {
	BinDir  string
	IsDebug bool
}

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(ioStream *IOStream, cfg *ExecutorConfig) *Executor

func (*Executor) AddEnv

func (e *Executor) AddEnv(k, v string)

func (*Executor) Exec

func (e *Executor) Exec(cmdName string, args []string) error

func (*Executor) ExecBackground added in v0.1.9

func (e *Executor) ExecBackground(cmdName string, args []string) (string, error)

func (*Executor) SetEnv added in v0.1.7

func (e *Executor) SetEnv(k, v string)

type ExecutorConfig

type ExecutorConfig struct {
	IsDebug bool
}

type IOStream

type IOStream struct {
	Out, Err io.Writer
	In       io.Reader
}

type InstallCommand

type InstallCommand struct {
	// contains filtered or unexported fields
}

func NewInstallCommand

func NewInstallCommand(ioStream *IOStream, cfg *InstallCommandConfig) (*InstallCommand, error)

func (*InstallCommand) Run

func (c *InstallCommand) Run(pkgName string) error

type InstallCommandConfig

type InstallCommandConfig struct {
	DataDir           string
	BinDir            string
	InstallAllCommand bool

	IsDebug bool
}

type InstallPackage

type InstallPackage struct {
	Path    PackagePath
	Version string
	IsAll   bool
}

func NewInstallPackage

func NewInstallPackage(rawPkgName string, isAll bool) (*InstallPackage, error)

func (*InstallPackage) String

func (p *InstallPackage) String() string

type InstallPackages

type InstallPackages []InstallPackage

func (InstallPackages) Pathes

func (p InstallPackages) Pathes() []PackagePath

type InstalledPackage

type InstalledPackage struct {
	Path        PackagePath
	Version     string
	IsPinned    bool
	Executables []*Executable
}

type InstalledPackageRepository

type InstalledPackageRepository struct {
	// contains filtered or unexported fields
}

func NewInstalledPackageRepository

func NewInstalledPackageRepository(ioStream *IOStream, cfg *InstalledPackageRepositoryConfig) (*InstalledPackageRepository, error)

func (*InstalledPackageRepository) Delete added in v0.2.0

func (*InstalledPackageRepository) Get

func (*InstalledPackageRepository) List

func (*InstalledPackageRepository) Save

type InstalledPackageRepositoryConfig

type InstalledPackageRepositoryConfig struct {
	FilePath string
	IsDebug  bool
}

type InstalledPackages

type InstalledPackages []InstalledPackage

func (InstalledPackages) UpgradeTargets

func (p InstalledPackages) UpgradeTargets(isAll bool) []InstallPackage

type InvalidParamError

type InvalidParamError struct {
	Message string
}

func (*InvalidParamError) Error

func (e *InvalidParamError) Error() string

type JSONStore

type JSONStore struct {
	// contains filtered or unexported fields
}

func NewJSONStore

func NewJSONStore(ioStream *IOStream, cfg *JSONStoreConfig) (*JSONStore, error)

func (*JSONStore) Delete added in v0.2.0

func (s *JSONStore) Delete(key string) error

func (*JSONStore) Get

func (s *JSONStore) Get(key string, v interface{}) error

func (*JSONStore) GetAll

func (s *JSONStore) GetAll() (map[string]json.RawMessage, error)

func (*JSONStore) Save

func (s *JSONStore) Save(key string, v interface{}) error

type JSONStoreConfig

type JSONStoreConfig struct {
	FilePath string
	IsDebug  bool
}

type ListCommand

type ListCommand struct {
	// contains filtered or unexported fields
}

func NewListCommand

func NewListCommand(ioStream *IOStream, cfg *ListCommandConfig) (*ListCommand, error)

func (*ListCommand) Run

func (c *ListCommand) Run() error

type ListCommandConfig

type ListCommandConfig struct {
	DataDir string
	IsDebug bool
}

type NopWriter

type NopWriter struct{}

func (*NopWriter) Write

func (*NopWriter) Write(buf []byte) (int, error)

type PackageInstaller

type PackageInstaller struct {
	// contains filtered or unexported fields
}

func NewPackageInstaller

func NewPackageInstaller(ioStream *IOStream, cfg *PackageInstallerConfig) (*PackageInstaller, error)

func (*PackageInstaller) Install

type PackageInstallerConfig

type PackageInstallerConfig struct {
	BaseDir string
	IsDebug bool
}

type PackageNotFoundError

type PackageNotFoundError struct {
	Path PackagePath
}

func (*PackageNotFoundError) Error

func (e *PackageNotFoundError) Error() string

type PackagePath

type PackagePath string

func NewPackagePath

func NewPackagePath(rawPkgPath string) (PackagePath, error)

type PackageUninstaller added in v0.2.0

type PackageUninstaller struct {
	// contains filtered or unexported fields
}

func NewPackageUninstaller added in v0.2.0

func NewPackageUninstaller(ioStream *IOStream, cfg *PackageUninstallerConfig) (*PackageUninstaller, error)

func (*PackageUninstaller) Uninstall added in v0.2.0

func (u *PackageUninstaller) Uninstall(pkg *InstalledPackage) error

type PackageUninstallerConfig added in v0.2.0

type PackageUninstallerConfig struct {
	BaseDir string
	IsDebug bool
}

type ParsePackageError

type ParsePackageError struct {
	Target string
	Err    error
}

func (*ParsePackageError) Error

func (e *ParsePackageError) Error() string

func (*ParsePackageError) Unwrap

func (e *ParsePackageError) Unwrap() error

type PinCommand added in v0.1.9

type PinCommand struct {
	// contains filtered or unexported fields
}

func NewPinCommand added in v0.1.9

func NewPinCommand(ioStream *IOStream, cfg *PinCommandConfig) (*PinCommand, error)

func (*PinCommand) Run added in v0.1.9

func (c *PinCommand) Run(pkgName string) error

type PinCommandConfig added in v0.1.9

type PinCommandConfig struct {
	DataDir string

	IsDebug bool
}

type Prompter

type Prompter struct {
	// contains filtered or unexported fields
}

func NewPrompter

func NewPrompter(ioStream *IOStream, cfg *PrompterConfig) *Prompter

func (*Prompter) AskYN

func (p *Prompter) AskYN(msg string) bool

func (*Prompter) ChooseToForceOverwrite

func (p *Prompter) ChooseToForceOverwrite(destPath string) bool

func (*Prompter) Select added in v0.1.5

func (p *Prompter) Select(msg string, candidates []string, defaultIndex int) int

func (*Prompter) SelectExecutableToDisable

func (p *Prompter) SelectExecutableToDisable(exec *Executable) *Executable

func (*Prompter) SelectPackage added in v0.1.5

func (p *Prompter) SelectPackage(pkgs []InstalledPackage) *InstalledPackage

type PrompterConfig

type PrompterConfig struct {
	IsDebug bool
}

type RemoveCommand added in v0.2.0

type RemoveCommand struct {
	// contains filtered or unexported fields
}

func NewRemoveCommand added in v0.2.0

func NewRemoveCommand(ioStream *IOStream, cfg *RemoveCommandConfig) (*RemoveCommand, error)

func (*RemoveCommand) Run added in v0.2.0

func (c *RemoveCommand) Run(pkgName string) error

type RemoveCommandConfig added in v0.2.0

type RemoveCommandConfig struct {
	DataDir string
	BinDir  string

	IsDebug bool
}

type ShowCommand added in v0.1.8

type ShowCommand struct {
	// contains filtered or unexported fields
}

func NewShowCommand added in v0.1.8

func NewShowCommand(ioStream *IOStream, cfg *ShowCommandConfig) (*ShowCommand, error)

func (*ShowCommand) Run added in v0.1.8

func (c *ShowCommand) Run(pkgName string) error

type ShowCommandConfig added in v0.1.8

type ShowCommandConfig struct {
	DataDir string
	IsDebug bool
}

type TablePrinter

type TablePrinter struct {
	// contains filtered or unexported fields
}

func NewTablePrinter

func NewTablePrinter(ioStream *IOStream, cfg *TablePrinterConfig) *TablePrinter

func (*TablePrinter) PrintExecutables added in v0.1.8

func (p *TablePrinter) PrintExecutables(execs []*Executable) error

func (*TablePrinter) PrintInstalledPackages

func (p *TablePrinter) PrintInstalledPackages(pkgs []InstalledPackage) error

type TablePrinterConfig

type TablePrinterConfig struct {
	IsDebug bool
}

type UnpinCommand added in v0.1.9

type UnpinCommand struct {
	// contains filtered or unexported fields
}

func NewUnpinCommand added in v0.1.9

func NewUnpinCommand(ioStream *IOStream, cfg *UnpinCommandConfig) (*UnpinCommand, error)

func (*UnpinCommand) Run added in v0.1.9

func (c *UnpinCommand) Run(pkgName string) error

type UnpinCommandConfig added in v0.1.9

type UnpinCommandConfig struct {
	DataDir string

	IsDebug bool
}

type UpgradeCommand

type UpgradeCommand struct {
	// contains filtered or unexported fields
}

func NewUpgradeCommand

func NewUpgradeCommand(ioStream *IOStream, cfg *UpgradeCommandConfig) (*UpgradeCommand, error)

func (*UpgradeCommand) Run

func (c *UpgradeCommand) Run(pkgName string) error

type UpgradeCommandConfig

type UpgradeCommandConfig struct {
	InstallAllCommand bool
	DataDir           string
	BinDir            string

	IsDebug bool
}

Directories

Path Synopsis
cmd
got

Jump to

Keyboard shortcuts

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