rio

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Path string
	Args []string
	Env  [][2]string
	Dir  string

	Shell bool // hack for when ssh-ing, try to start a shell instead of just executing a command (gives you working environment vars, etc)

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer

	Context context.Context

	// ReadOnly indicates that this command does not have side effects, and is safe to run in dry-run mode.
	ReadOnly bool
}

func Command

func Command(ctx context.Context, path string, args ...string) *Cmd

func ReadOnlyCommand

func ReadOnlyCommand(ctx context.Context, path string, args ...string) *Cmd

func (*Cmd) String

func (cmd *Cmd) String() string

type CmdErr

type CmdErr struct {
	Cmd     *Cmd
	StdErr  string
	ExecErr error
}

func (CmdErr) Error

func (c CmdErr) Error() string

type Group

type Group struct {
	Name string
	Gid  uint32
}

type Host

type Host interface {
	String() string
	Info() (*Info, error)

	TmpFile() (string, error)
	TmpDir() (string, error)
	Cleanup() error

	Exec(cmd *Cmd) error

	Stat(string) (os.FileInfo, error)
	Open(string) (io.ReadCloser, error)
	ReadFile(string) ([]byte, error)
	Create(string) (io.WriteCloser, error)
	Remove(string) error // I'd rather call this Delete. But in this case, follow "os" package style.
	Chmod(string, os.FileMode) error
	Chown(string, uint32, uint32) error
	Rename(string, string) error

	User(string) (*User, error)
	CreateUser(*User) error
	UpdateUser(*User) error
	DeleteUser(string) error

	Group(string) (*Group, error)
	CreateGroup(*Group) error
	UpdateGroup(*Group) error
	DeleteGroup(string) error

	Password(string) (*Password, error)
	UpdatePassword(*Password) error
}

type Info

type Info struct {
	Uname    string
	Hostname string
	Kernel   string
	OS       string
	Arch     string
}

func (*Info) String

func (info *Info) String() string

type Password

type Password struct {
	Name  string
	Crypt string
}

type User

type User struct {
	Name    string
	Uid     uint32
	Group   string
	Groups  []string
	Home    string
	Shell   string
	Comment string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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