entity

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SSUP_WORK_FOLDER       = consts.SSUP_WORK_FOLDER
	MAIN_SCRIPT            = consts.MAIN_SCRIPT
	VARS_FILE              = consts.VARS_FILE
	HASHED_PASS            = consts.HASHED_PASS
	INJECTED_COMMANDS_FILE = consts.INJECTED_COMMANDS_FILE
	VERSION                = consts.VERSION
	PassSeparator          = consts.PassSeparator
	TubeNameSeparator      = consts.TubeNameSeparator
	CsupPasswdEnv          = consts.CsupPasswdEnv
	CsupDoSudoEnv          = consts.CsupDoSudoEnv
)

Re-export constants from the consts package to maintain compatibility

Variables

View Source
var (
	Colors = []string{
		"\033[32m",
		"\033[33m",
		"\033[36m",
		"\033[35m",
		"\033[31m",
		"\033[34m",
	}
	ResetColor = "\033[0m"
)
View Source
var (
	ErrUsage            = errors.New("Usage: sup [OPTIONS] NETWORK COMMAND [...]\n       sup [ --help | -v | --version ]")
	ErrUnknownNetwork   = errors.New("Unknown network\nif Supfile has networks: section defined\nyou MUST give network name as a first argument")
	ErrNetworkNoHosts   = errors.New("No hosts defined for a given network")
	ErrCmd              = errors.New("Unknown command/target")
	ErrTargetNoCommands = errors.New("No commands defined for a given target")
	ErrConfigFile       = errors.New("Unknown ssh_config file")
)
View Source
var ExampleSupfile = `` /* 1158-byte string literal not displayed */

ExampleSupfile is an example supfile.

Functions

func IsShell

func IsShell(cmd string) bool

Re-export utility functions from usecase utils to maintain compatibility

func ResolveShell

func ResolveShell(value string) (string, error)

Types

type ArgParserFacade

type ArgParserFacade interface {
	Parse(conf *supfile.Supfile, initialArgs *InitialArgs, helpMenu HelpDisplayer) (*PlayBook, error)
}

type ClientFacade

type ClientFacade interface {
	GetConnection() *ssh.Client
	GetSSHConfig() *ssh.ClientConfig
	Connect(host supfile.NetworkHost) error
	SetConnection(*ssh.Client)
	Run(task *Task) error
	Wait() error
	Close() error
	Prefix() (string, int)
	Write(p []byte) (n int, err error)
	WriteClose() error
	Stdin() io.WriteCloser
	Stderr() io.Reader
	Stdout() io.Reader
	Signal(os.Signal) error
	Upload(src string, dest string) error
	Download(src string, dest string, silent bool, flat bool) error
	GenerateOnRemote(data []byte, dest string) error
	GetHost() string
	GetTube() string
	SetTube(name string)
	GetInventory() *Inventory
	GetShell() string
	String() string
	CopyDistFolders() error
}

type Command

type Command = supfile.Command

Re-export structs

type ConnectOrder

type ConnectOrder struct {
	Host         string // will contain ip:port
	ClientConfig *ssh.ClientConfig
}

type DownloadOrder added in v0.7.1

type DownloadOrder = supfile.DownloadOrder

Re-export structs

type EnvList

type EnvList = supfile.EnvList

Re-export types from subpackages to maintain compatibility

type EnvVar

type EnvVar = supfile.EnvVar

Re-export types from subpackages to maintain compatibility

type ErrMustUpdate

type ErrMustUpdate = supfile.ErrMustUpdate

Re-export types from subpackages to maintain compatibility

type ErrTask

type ErrTask struct {
	Task   *Task
	Reason string
}

func (ErrTask) Error

func (e ErrTask) Error() string

type ErrUnsupportedSupfileVersion

type ErrUnsupportedSupfileVersion = supfile.ErrUnsupportedSupfileVersion

Re-export types from subpackages to maintain compatibility

type FlagStringSlice

type FlagStringSlice []string

func (*FlagStringSlice) Set

func (f *FlagStringSlice) Set(value string) error

func (*FlagStringSlice) String

func (f *FlagStringSlice) String() string

type HelpDisplayer

type HelpDisplayer struct {
	ShowNetwork bool
	ShowCmd     bool
	// ShowTarget   bool
	ShowMakeMode bool
	Color        bool
}

func (*HelpDisplayer) Show

func (h *HelpDisplayer) Show(conf *supfile.Supfile)

func (*HelpDisplayer) ShowAll

func (h *HelpDisplayer) ShowAll(conf *supfile.Supfile)

type HostNamespace

type HostNamespace struct {
	EnvStore map[string]string
}

HostNamespace stores env vars from the host it has methods to get and set env variables

func (*HostNamespace) Get

func (h *HostNamespace) Get(key string) string

Get returns the value of the env var

func (HostNamespace) Set

func (h HostNamespace) Set(key, value string)

Set sets the value of the env var

func (*HostNamespace) Unset

func (h *HostNamespace) Unset(key string)

Unset unsets the value of the env var

type InitState

type InitState struct {
	Conf        *supfile.Supfile
	InitialArgs *InitialArgs
}

type InitialArgs

type InitialArgs struct {
	Supfile     string
	EnvVars     FlagStringSlice
	SSHConfig   string
	OnlyHosts   string
	ExceptHosts string

	Debug         bool
	DisablePrefix bool

	ShowVersion     bool
	ShowExample     bool
	ShowHelp        bool
	DisableColor    bool
	TestConnections bool
	CommandArgs     []string
	Force           bool
}

InitialArgs contains values from flags during program init

var InitialArgsStore *InitialArgs = &InitialArgs{}

type Inventory

type Inventory struct {
	Bash    bool
	Sh      bool
	Arch    string
	Home    string
	User    string
	OsType  string
	IsLocal bool
}

func (*Inventory) CheckBashCommand

func (i *Inventory) CheckBashCommand() []string

func (*Inventory) CheckHomeCommand

func (i *Inventory) CheckHomeCommand() []string

CheckHomeCommand returns the command to get the home directory based on the OS type

it's expected that it will run AFTER a call to check os type

func (*Inventory) CheckOsTypeCommand

func (i *Inventory) CheckOsTypeCommand() []string

func (*Inventory) CheckShCommand

func (i *Inventory) CheckShCommand() []string

func (*Inventory) CheckUserCommand

func (i *Inventory) CheckUserCommand() []string

func (*Inventory) DetectArchCommand

func (i *Inventory) DetectArchCommand() []string

func (*Inventory) GetHomeUnixCommand

func (i *Inventory) GetHomeUnixCommand() []string

func (*Inventory) GetHomeWinCommand

func (i *Inventory) GetHomeWinCommand() []string

func (*Inventory) GetShell

func (i *Inventory) GetShell() string

type Network

type Network = supfile.Network

Re-export structs

type NetworkHost

type NetworkHost = supfile.NetworkHost

Re-export structs

type Play

type Play struct {
	Network  *supfile.Network
	Commands []*supfile.Command
}

type PlayBook

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

func (*PlayBook) AddPlay

func (p *PlayBook) AddPlay(play Play)

func (*PlayBook) GetPlays

func (p *PlayBook) GetPlays() []Play

func (*PlayBook) IsMakefileMode

func (p *PlayBook) IsMakefileMode() bool

func (*PlayBook) MarkAsMakefileMode

func (p *PlayBook) MarkAsMakefileMode()

type RunOrder added in v0.7.1

type RunOrder struct {
	MakefileMode bool
	Network      *supfile.Network
	Vars         supfile.EnvList
	Commands     []*supfile.Command
	Args         InitialArgs
}

type ShellCheckFacade

type ShellCheckFacade interface {
	Check(cmd string, cmdName string) error
	AddNumbers(data []byte) []byte
}

type Supfile

type Supfile = supfile.Supfile

Re-export types from subpackages to maintain compatibility

type Task

type Task struct {
	Run     string
	Input   io.Reader
	Clients []ClientFacade
	TTY     bool
	Sudo    bool `yaml:"sudo" default:"false"`
	Env     supfile.EnvList
	// num     int
	Id   string
	Dist string
}

Task represents a set of commands to be run.

type UploadOrder added in v0.7.1

type UploadOrder = supfile.UploadOrder

Re-export structs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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